171

Using multiple screens I normally place multiple classes (files) in different screens, this helps me a lot while refactoring, checking tests and comparing changes. Visual Studio Code does not allow me to drag a tab outside the window and view it in (for example) another monitor. I checked the documentation and plugins, but the only way I found, is to open two windows, pointing to the same project (folder) and put those in different screens. I don't like this solution, that causes also some problem when I watch code changes using TypeScript.

Any suggestion?

I use Windows 10, latest version of VSCode.

Norcino
  • 5,850
  • 6
  • 25
  • 42
  • 1
    There is an issue open in github if you want to upvote it there: https://github.com/Microsoft/vscode/issues/10121 – AntonJ Nov 14 '17 at 11:37

8 Answers8

188

A solution is to press CTRL+K and after releasing CTRL, press O.

This will open the current file in a new window.

There are few things I don't like about this solution:

  • Drag and Drop does not work
  • Create a new instance of VS Code resulting in (for me) 180MB of ram used
  • To open the file it takes to me few seconds (quite slow)
  • The file remains open in the original window as well

Update 20/03/2019:

There is a feature request you can track here:

https://github.com/Microsoft/vscode/issues/10121

And an explanation about why this is difficult to implement here:

https://github.com/Microsoft/vscode/issues/10121#issuecomment-345770248


Update 20/03/2019:

Another important side effect highlighted by @Mär is that:

the IntelliSense fails to establish references it had when the file was opened in the window, where the entire project is opened

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
Norcino
  • 5,850
  • 6
  • 25
  • 42
  • 40
    Related to this answer: Press `CTRL+SHIFT+N` at any time to open a new instance of VS Code, then you can drag tabs into it. – Christopher Sep 26 '18 at 21:00
  • 2
    If I follow these instructions and open a new VS Code window using `CTRL`+`K`, `O`, then IntelliSense fails to establish references it had when the file was opened in the window, where the entire project is opened. – Koenigsberg Jul 15 '19 at 11:06
  • in my case ctrl+k just opens search (same as ctrl + f) – dermoritz Nov 27 '20 at 11:28
  • @dermoritz do CTRL+SHIFT+P this will open the dialogue at the top, type "Open Keyboard Shortcuts" you might have fiddled with the default configuration. You can change this as you prefer and test also the combination of keys. The name of the shortcut is "Open Active File In New Window". See: https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf – Norcino Nov 27 '20 at 12:59
  • According to the last comment on the issue, this is the number one requested feature. That comment was from late 2018, over 2 years ago now. Who's prioritizing the backlog for VS Code? I get that it might be difficult, but they could have rewritten the whole app in that time, right? – Derek Greer Mar 07 '21 at 12:04
  • 4 years , it's 20220607 now. New window not work for outline – Jiang YD Jun 07 '22 at 06:17
142

The easy way but with the same drawbacks. More ram and resources will be used. Is to wrap your project in a folder.

It's the best possible thing. As by now!

=> Duplicate the workspace.

Open the command pannel ctrl+shift+p or F1. Then write dupl

You'll get that enter image description here

That's it.

More

If you want to add more folder to the working space. => go to File then Add Folder To Workspace enter image description here You can add as many as you like.

 Also better more

You can open a new window (ex: ctrl+n)

And then go File > Add Folder To Workspace.

And start adding folders to your new Workspace. You can add any folder, that is already open or not. That's too way great. You can have all the needed folders for example in the second screen.

starball
  • 20,030
  • 7
  • 43
  • 238
Mohamed Allal
  • 17,920
  • 5
  • 94
  • 97
34

A little hack I used is to just stretch the editor window to fill both screens and split the view pane between the monitors such that both screens show just one open file.

enter image description here

This is a cheap hack that works without opening multiple instances of VSC.

It may not be the proper solution, but it works without eating up all my system memory.

ak_linus
  • 532
  • 4
  • 6
28

I found the following way to work on multiple monitors (important: they must be the same size and resolution):

  1. open a visual studio in windowed mode on the 1st monitor (in my case it is a left monitor)
  2. move the window to the (left) top corner
  3. stretch window to the 2nd monitor (right) bottom corner
  4. split screen by clicking “split editor” several times
  5. move the code sections separator to the edge between the monitors

This is old qestion, but such way can be useful for someone. It is not very convenient, but it works. The solution may have already appeared in the VS itself, but I didn't find it.

Ivan
  • 445
  • 4
  • 6
  • 3
    I used this approach, but is fiddly and doesn't offer the same benefits of having an independent window, such moving it left, right of the screen or minimize/maximize. – Norcino Jul 10 '19 at 13:51
  • 4
    This is not bad (+1) but when both displays are not the same size/resolution, then the text content of a second-display part of the window can be too small/big to use. – Jarda Aug 08 '19 at 12:31
  • This solution only works if all monitors directly in-line/horizontal, and the same size/resolution. I have both a 2K and a 4K monitor of different physical sizes and at different heights -- so it simply won't work. Part of the window is either off-screen on the small monitor, or truncated on the big monitor -- neither of which are nice. – Human-Compiler Nov 17 '21 at 16:26
  • I have 2 monitors with the same size, but on both I use Windows taskbar in the middle vertical, so unfortunately it stays on top of the VSCode window in the middle. – v.karbovnichy Mar 30 '22 at 11:58
17

Visual Studio Code does not allow me to drag a tab outside the window and view it in (for example) another monitor

Actually, VSCode 1.57 (May 2021, 4 years later) will propose something close:

Improved editor drag and drop across windows

Support for dragging editors to other windows was improved in this release. You can now drag diff editors, custom editors and the entire editor group to another window to open the editors there.

Improved editor drag and drop across windows -- https://media.githubusercontent.com/media/microsoft/vscode-docs/vnext/release-notes/images/1_57/editor-dnd.gif

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 2
    I am on 1.56.2 and this is already working, the problem is that you need to first open a new instance of VSCode, and then drop the file there, meaning that the above solution is still the quickest for the first time you want to move a file in a new window (to then move this window in another screen). I it would be nice to really have a drag and drop experience (move tab), from the video (and current behaviour) it looks like is just opening the same file also int the targeted window, creating a duplicate, so not really a D&D – Norcino Jun 04 '21 at 09:51
  • 1
    @Norcino OK. I will check if there is any difference in 1.57. – VonC Jun 04 '21 at 10:08
  • 1
    Unfortunately this does not work if using Remote Containers, understandably so, but I use them for all my dev work. – Justin Phillips Nov 15 '21 at 16:31
  • @JustinPhillips True. That is unfortunate. – VonC Nov 15 '21 at 16:35
  • 4
    This seems to be the quickest/easiest method, but this (along with the "Duplicate workspace in new window" answer above) doesn't seem to keep edits to my files in sync. I type in one window and it isn't reflected in the other window (while it does stay in sync across tabs in the same window). I guess I can at least use this as view-only. – gamingexpert13 Nov 18 '21 at 02:51
7

My solution was to use Remote-ssh to connect to self and open in another window. This does take extra resources. But I find this comfortable as I don't need to create additional workspace.

Rithvik Nishad
  • 517
  • 8
  • 11
0

For me on Ubuntu the solution was to create a project folder symlink and ope it in a new window (as it won't open the same folder in another window)

Dmytro
  • 1
-1

Resize the window actrost multiple monitor s works great even if your primary is a different resolution this can be fixed if the secondary is on the right not so much if on the left. When on the right open a terminal or problem pane at the bottom and resize this on the right monitor to a size that works on the main and limits the cutoff on the secondary. Then open your second project file and select split right and move the split to the edge of your screen. The terminal prevents the cutoff of the working area. You can follow the same steps for the left hand side but the terminal/problem pane will be cutoff by the resolution differences. With windows 11 this is less noticeable because of built in features. I know this already a suggested answer but I am unable to comment because of my rep points are still to low

Matthew Baker
  • 17
  • 1
  • 1
  • 5