I installed VS Code and am unable to open multip[le files at once. Every time I open one file and want to open the other, the one opened gets replaced so there is only one tab/file open.
Whats going on?
Related
My workflow with VS Code is to always use project folders on projects. This works great, but there's one thing that's messing things up right now;
When opening just a single file from another project while working in another project, lets's say webpack.config.js, I use Windows Explorer rightclick to open that file in VS Code. However, this always opens the file in the currently open VS Code instance.
This adds the file from that other folder now to the memory of the previously opened files in the open project while it has nothing to do with that project.
When using the quick file open of VS Code now it happens a lot VS Code opens a file from that other folder, only because that outside file has been opened once while I was working on this project.
This is error prone as now it happens a lot, especially when working fast, that the wrong, for instance, package.json or webpack.config.js file gets opened, because VS Code now also suggests files that are outside this project. That's pretty frustrating and causes changes to be made in the wrong files pretty quickly.
I know we can clear the editor history and have to do it a lot now. But to me that's the other way around, doesn't solve the real problem and when not done often the issue remains.
So I want to get rid of this issue and have the following questions:
1) How can we change the 'Open with Code' rightclick menuitem in Explorer to open files always in a new instance of VS Code?
2) Is there a config settings to disable the behaviour that VS Code remembers files that are outside of the current work folder?
Thanks in advance, this thing is bothering me for quite some time now!
How can we change the 'Open with Code' rightclick menuitem in Explorer to open files always in a new instance of VS Code?
I assume you are a Windows user. You can edit the context menu behavior from Regedit.
Follow the below steps:
Press Windows + R
Type regedit and press OK
Go to Computer\HKEY_CLASSES_ROOT\*\shell\VSCode\command in regedit
Add -n parameter to the command like below
It will help you to open every file in a new window when you use Open with Code.
For your second question, Is there a config settings to disable the behavior that VS Code remembers files that are outside of the current work folder?
Open VS Code settings
Search window.openFilesInNewWindow
Make it off to on like below
With this configuration, you can't open new files in the current workspace therefore technically you prevent VS Code remember outside files. Not directly but it helps.
I don't like how "recently opened" files are shown in VS Code Quick Open (Ctrl+P). I think OP is describing this behavior...
The behavior to remember "recently opened" files causes me problems when I mistakenly open a temporary/copy of my file, i.e.
C:/users/temp/code.js
... instead of the true file (i.e. located inside the currently-open VS Code project)
C:/git/source-control/code.js
...my confusion happens because because both files are listed among the options when I use Quick Open Ctrl+P and type "code"
For me , the Quick Open list also has the answer, any "recently-open" files should have an "X" icon on the right side. You may need to hover your mouse over the file you want to remove.
Click the "X" icon to "Remove from recently open". Quick Open will always be able to find files in your current project, even if you remove them from recently-open:
Please note I don't have access to regedit as suggested in the accepted answer; my answer here does not require regedit
Sorry (to all/any) if this has been asked. But I can't find a match to the question (at least not one that I interpret as such anyway).
I'm new to Visual Studio Code and loving it. One the features I use a lot is having multiple editor windows open on the same file (i.e. to be editing different, but related sections of the code).
Now... If I use 'Save', all edits in all open windows are saved. However, if I 'Save As' the file is saved as a new file, but only the active editor window is now accessing that file. Any other open editor windows are still connected to original (i.e. pre 'Save as') version of the file.
This means (e.g. when simply amending the file version number) having to close all other windows, then reopen and get each back to the sections they where focused on.
Is there any way to tell VSC that a Save As should be reflected in all open windows (of the same file)?
I accidently opened a file that didn't have a suffix, just "file.", that doesn't even exist and now whenever I try to close it, VS Code crashes. When I reopen Code, it always reopens the file. I've scoured settings and tried these fixes but nothing helps.
Visual Studio Code always reopens previous file or folder
How can I completely clear the cache for VS code and stop reopening files? It should be possible outside of VS Code because I get the feeling settings aren't be preserved because of the corrupt file.
FWIW, I was able to track down the call to the file in $HOME/.config/Code/Backups. Once I removed the offending Backup file, I can open Code once again without loading the corrupt file.
I'm trying to save time as I open a lot of files all day with vscode and have a decent screen real estate. I always want to see the sets of files I open next to each other. Is there a way of opening a set of files but not have them tabbed, but open auto-arranged so I can see the contents of all of them at the same time?
I had to create multiple linked resources pointing to a single physical file in an Eclipse project. The problem is, whenever I try to open these two files, the editor opens each file in a separate tab, it won't direct me to the already opened file.
This is different from how VisualStudio works. VisualStudio has an option to add an existing file to a project. A single file can be used in multiple projects. Whenever we open both files, VS will direct us to the already opened file, it won't open the file in a new tab.
It's possible that developers open/edit multiple files at the same time and not notice that the same physical file was opened more than once. This behavior can potentially cause a lot of problems, for example, if File 1 is modified but not saved, and later File 2 is modified then saved, all modifications previously done in File 1 will be lost.
Is there any preference to turn-off/on this behavior? If not, can I implement this hook as a plugin?