Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Visual Studio offer split code viewing

I just recently realized that Visual Studio offers the ability to split the code view into 2 sections (top and bottom). Now, having played with it a bit, if you make changes in one, it affects the other. My question is, what is the purpose of this? How do people use it?

In case you're unaware of this, one way of splitting the code view is by moving this slider circled in the picture:

enter image description here

like image 438
PiousVenom Avatar asked Jun 15 '26 22:06

PiousVenom


2 Answers

Code Review

I occasionally use it to view a method that is called from another method during a code review. For instance, if I am code reviewing method A, and it calls B, and I want to see A and B at the same time, I will pull that down, and scroll one to B, and leave the other at A.

private void A()
{
    // code here
    B();
}

// other methods here that push B out of the viewable area.

private void B()
{
    // code here
}

Pro Tip

Another way to flip back and forth with just the keyboard, although you wouldn't see both methods at the same time, is to hit F12 on the call to B within A, which is a shortcut to "Go To Definition", and then hitting Ctrl+-, which is a shortcut for "Navigate Backwards", which brings you back to where your cursor was previously. I frequently use Ctrl + Shift + - to navigate forwards, and Ctrl + - to navigate backwards.

Trivia

This extra viewing pane isn't exclusive to Visual Studio. You will notice Sql Server Management Studio, MS Word, and MS Outlook have the same functionality. I presume many other apps do too.

like image 144
Seth Flowers Avatar answered Jun 17 '26 20:06

Seth Flowers


Viewing Multiple Functions, Classes, or anything can be viewed.. whenever you want to see multiple things at a time, this split view can be useful.

like image 23
Fatima Khan Avatar answered Jun 17 '26 20:06

Fatima Khan