Visual Studio Code remembering old/wrong open editors? - visual-studio-code

Previous searches for Visual Studio Code show responses for not remembering any open editors, or the opposite, but I seem to be having a novel problem. Within the same workspace, closing VSC and reopening (e.g. after a restart) will reopen some editor windows but they are often files that I had worked in and closed in the past, not the files I had open when VSC was shut down. The Restore Windows setting is set to all. Limit: Enabled for the amount of editors allowed to be open is not checked. Autosave is enabled.
Do I need to be manually saving my workspace? Is there some other obvious setting I'm missing?

Related

Visual Studio Code: Remote Workspace reopen after close

I am trying to figure out if its possible to have vscode reopen my remotely saved workspace on open of the program automatically.
Additional info:
I have the settings for a normal reopen on (restoreWindow).
I see the workspace on my Open > Recents, but I want to automate this part
Interestingly after a couple times opening and closing (didn't really pay attention to it, after two hours I noticed), it opens the workspace on its own. I was reopening it manually from Recents in the meantime.
It would be great to know where is this info stored in vscode to debug it manually.

VSCode open by itself new editor with settings.json

I don't know what happen, but I was working on VSCODE in windows adding neovim path to the settings.json.
I clicked inside the settings.json and vscode started to open new editor tabs by itself with the same content of settings.json.
I have uninstalled vscode several times, removed the Appdata roaming vscode, the Appdata local code, etc. I installed the vscode again and same behavior. I restarted my windows machine and same behavior.
The sync is on so the settings replicates to all my vscode installations. I started my Linux machine to see if this was something that replicated to my linux version. No, it is working normal.
I can work on VScode if I don't open the settings. It has open new editors (clones of settings) upto 500 hundred times.
I was able to stop it when I changed directory and it asked me if I wanted to close and all open tabs. The moment that I go to settings starts again.
You could start to not sync extentions. Maybe one is breaking it.
But You could also try to install an older version of vs code.
How to downgrade vscode

CMD-K in Visual Studio Code

I often clear the terminal on macOS with CMD-K (sort of equivalent to reset). When I use the terminal in Visual Studio Code and I press CMD-K, the banner at the bottom of the screen shows "(CMD-K) was pressed. Waiting for second key of chord..."
How can I make CMD-K pass through the editor to go to the terminal in Visual Studio Code?
I have occasionally run into this bug (VS Code on MacOS) and each time it randomly would fix itself until recently it kept persisting even through restarting my laptop. I have now found that closing all open projects seems to fix this issue for me.
Might be related to how VS Code stores your current workspace state (opened projects and file modifications). It seems maybe these state settings sometimes get corrupted somehow 🤔

Reopen last closed tabs

I'm new to Visual Studio Code. I've been tinkering with the settings for a while now and haven't yet found a way to make VSCode automatically reopen last closed tab(s). Say, I opened file 1, closed VSCode, went to open file 2 (in a separate folder), just to end up with only one tab opened despite what I have in my settings.json file:
"files.hotExit": "onExit",
"window.reopenFolders": "all",
"window.restoreWindows": "all"
I don't mind accumulated tabs every time I open VSCode, (Ctrl+w exists for a reason); if Notepad++ and Sublime Text can do it, then why not VSCode? Or am I missing something?
VS Code can currently only open one workspace in one window. Unless you have manually specified a multi-root workspace, VS Code will always open new files and folders as separate workspaces.

VS Code open last files

I gave a chance to Visual Studio Code as my primary editor. I had been using Notepad++ and afterwards I have been using Sublime Text 2 and 3 for few years. I do see potential of this editor and I really like it, but there is one thing I am strongly used to.
Notepad++ and Sublime Text has this feature, I can edit file and DON'T save it anywhere. After restart Notepad/Sublime Text this file is there ready for me.
Other workflow could be open any file from my local storage, close VS Code and start it again. This file will not open!
I know about that when I open folder and restart VS Code, folder is open and files as well. But is there any way how can I manage to have opened files after restart without having opened folder?
Edit: This is now implemented:
// Controls whether unsaved files are remembered between sessions, allowing the save prompt when exiting the editor to be skipped.
"files.hotExit": "onExit"
I use the insider release, and in the current version (1.3.0), vscode doesn't keep unsaved file. I think there is a feature request for that.
Got it: https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/8568343-keep-unsaved-files-after-crash
You can vote for that feature, like I did !
On the other hand, You can tell in settings if you want to re-open previously opened folders, but not files.
"window.reopenFolders": "all"