I want to be able to edit one method while looking at another method in the same file, as reference. Can this be done?
-
7possible duplicate of [Open two instances of a file in single Visual Studio session](http://stackoverflow.com/questions/728949/open-two-instances-of-a-file-in-single-visual-studio-session) – nawfal Jun 14 '14 at 06:54
-
I don't think this is a duplicate, @nawfal. Either way, the solutions in the other answer don't work in SSMS (v17.4). – BigSmoke Aug 20 '18 at 08:39
7 Answers
You can open the file in another tab (Window
-> New Window
).
Doing so you have two copies of the same file. Then you can right-click the tab bar and select New Vertical Tab Group
(or New Horizontal Tab Group
, the one you like more).
Hope I understood you question..
-
51
-
14
-
6Just wanted to add a keyboard shortcut for this: 1) ```Alt + w,n``` for ```New Window``` and ```Alt+w,v``` for ```New vertical tab group``` – dmytro.poliarush Dec 11 '19 at 15:27
Only vertically that I'm aware. When looking at the code, right above the vertical scroll bar is a small rectangle, drag it down to get a split view of the file.
![](../../users/profiles/13154.webp)
- 65,117
- 17
- 91
- 151
Be on the tab you want to duplicate,
then click in the menu bar at the top onWindow
>New Window
Finally drag & drop the second window to the the left or right side to show both views next to each other.
Et voila, there you have it :)
EDIT
It seems that this function is not implemented in all version of VS.
In my case (V 15.4.2 (2017)
, V 15.9.7 (2017)
& V 16.2.5 (2019)
) it just works fine.
-
1This does not work in VS 2015. It says that that tab is open and then closes it and reopen it. – Ryan Lee May 14 '18 at 22:20
-
1@RyanLee it does work for me, i haven't changed any settings, don't know where the problem could be. – Hille May 15 '18 at 10:32
-
I can confirm that this doesn't work in SSMS v17.4, for the same reason as stated by @RyanLee. – BigSmoke Aug 20 '18 at 08:35
-
1Works on 2017. And to complete the answer - Once you have the new tab, drag it and dock it to the side of the original tab – Oded Ben Dov Nov 21 '18 at 07:57
-
In VS 2017 v15.9.3 there is no New Window under Window menu when you're on the tab. – Jason Willett Dec 13 '18 at 15:34
-
@JasonWillett please take a look at my edit, as you can see it just works fine on a bit older build. – Hille Dec 18 '18 at 11:32
-
1
You simply use the small drag arrows icon at the top right corner of your file window as depicted in the following screenshots:
![](../../users/profiles/2846743.webp)
- 682
- 2
- 8
- 16
-
2tab groups is a vertical split, you have demonstrated a horizontal split. – odyth Jan 01 '19 at 02:44
-
1) View the same document side-by-side (with a fix for Visual Studio 2017)
It is possible to do this using New Window
and New Vertical Tab Group
, however, in my Visual Studio 2017 the New Window
command was missing from the Window
menu. To use it, first you must add the command to a menu or assign a shortcut to it.
To add New Window
to your Window
menu follow this sequence, starting with the Tools
menu:
Tools
> Customize
> Commands
> Menu Bar
> Window
> Add Command
> Window
> New Window
FYI In the Commands
step you decide where to put the New Window
command. The sequence I gave above puts it unceremoniously at the top of the Window
menu.
To view the same document side-by-side
- Open the document you want to view side-by-side
- Select your recently added
New Window
command (perhaps it's inWindow
>New Window
) - Right click the new tab and select
New Vertical Tab Group
or select that command from theWindow
menu
2) View the same document above-one-another
If you wish to view the same document in two views on top of each other use the Window
> Split
command or click-and-drag the double-arrow at the top of the scroll bar for any window.
3) Get creative
FYI You can even combine the two view options to have three, four or even more views of the same document on a particularly wide monitor. On mine (2560 x 1080) I can comfortably get three side-by-side views going and split them vertically, if desired.
-
This doesn't work in SSMS v17.4. When clicking _New window_, it will ask me whether to close to current window or not. – BigSmoke Aug 20 '18 at 08:36