'Open files in left or right-most panel in VS code
Is there a means to always open files chosen in VS Code's file explorer in a particular code editing panel, say the left or right-most panel?
I can use "Open to the side" (Ctrl-Enter) to open a file in a new panel, to the right. Otherwise a file opens (in preview or otherwise) in the currently active panel. This can be annoying, because often I'm working on a file in the active panel, and want to refer to another file in a side panel, but one which I already have open (with another file in it), rather than a new one. I have to activate the side panel first, and then open the file I want to see: but I usually forget which panel is active, and open the file I want to look at in place of the one I was editing...
I can use Ctrl-1, Ctrl-2 etc to switch to a panel before opening a file: but I'd rather be able to use the file explorer as a GUI to explore files, without having to think: if I could "pin" the file explorer to a given panel, it would be simpler.
Solution 1:[1]
Currently it is not possible. But i think there are two workarounds you could try to use:
Always close editor/editor group that you don't need so you would have only one editor open at the time of opening
to side
. To close current editor by default it isCTRL+F4
and to close whole editor group there is no default shortcut so you would have to add it yourself inKeyboard Shortcuts
tab.Limit the number of opened editors at one time to just 2, so opening to the side will replace older editor (not the one that was active last time). To do that you have to modify this two following settings:
"workbench.editor.limit.value": 2, "workbench.editor.limit.enabled": true,
Or you can just drag and drop with your mouse the file to the editor you want ;P
EDIT:
It would also be possible to create custom shortcut for that (checks if there are multiple editor groups multipleEditorGroups
and if so closes them and then just call open to side), here is example how to create one
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |