VScode caching Issue? File not showing newest changes - visual-studio-code

I've never seen this before so thought I'd ask here. My vscode isn't showing the latest changes in a file. When I open said file with vim, the file is up-to-date as expected. If I open that same file in vscode, it shows something else.
I've tried restarting vscode, using the 'Clear Editor History' command to clear the editor cache... I've restarted my machine. Nothing seems to work. Any thoughts?

Related

My Vscode terminal is not doing anything, there are no errors it just isn't doing anything

Very simply my Vscode terminal isn't doing anything it's there but it's not doing anything
Vscode terminal
I don't get any errors or anything it's just not doing anything.
I've tried running multiple diffrent files, I've restarted my computer and Vscode.
Not only that but a project i was working on just deleted.
How do I fix this

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

How to open VSCODE with new file from command line and preserve prior state?

Using Visual Studio Code (latest version as well as prior versions), when using the command line to launch I am seeing some odd behavior. Trying to determine if I am missing something, or if this is a bug.
Here is the scenario.
Action 1: I have a workspace open with a couple of files open for editing. If I close VSCODE, and then just open it again the state is restored, I am in the workspace and the files are open for editing. Great.
Action 2: I have a workspace open with a couple of files open for editing. If I then from a command line do "vscode testfile.txt" then the new file gets opened in VSCODE and joins the other opened file. Great.
Action 3: I have a workspace open with a couple of files open for editing. I close VSCODE. I then from a command line do "vscode testfile.txt". VSCODE starts up, but only the new file gets opened in VSCODE. The workspace I had opened is not any more, and the files I had opened are no longer opened. Not so great.
I have tried adding the -r option on the command line but that didn't change anything.
This feels like a bug, but if not help me understand how I get the desired result, which is when VSCODE is not running, and I try to edit a file from the command line, I want VSCODE to restore to the state it was in when last closed, and then add that new file to the mix. Just like if it was already running.

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"

Visual Studio Code: Auto-refresh file changes

Working with Visual Studio Code I have noticed if a file you are working with change, whenever that file get focused in a code panel it will be reloaded from the disk (if you don't have changes in the file through VSCode).
However, if you are on that file there is no alert to warning you about file changes.
I've been reviewing the settings and I cannot find anything like the visual studio option:
Detect when file is changed outside the environment
So my question: Is there any hidden setting or some hack to make that warning happen.
Update
Solved in version 0.3.0 of Visual Studio Code.
The file will be updated from disk if there is no changes through the editor. (very useful to read log files during a process execution)
If there are changes on both sides (from disk and through the editor) when ever you try to save the file using VSCode, the editor will warn you about that situation (i.e. "dirty writes") and a file comparison will allow you to decide what to do.
VSCode will never refresh the file if you have changes in that file that are not saved to disk. However, if the file is open and does not have changes, it will replace with the changes on disk, that is true.
There is currently no way to disable this behaviour.
{
"files.useExperimentalFileWatcher" : true
}
in Code -> Preferences -> Settings
Tested with Visual Studio Code Version 1.26.1 on mac and win
SUPER-SHIFT-p > File: Revert File is the only way
(where SUPER is Command on Mac and Ctrl on PC)
In version 1.57.1 (June 2021) there is still no setting like Detect when file is changed outside the environment.
But if the file was accidentally changed outside, you can easily revert the changes with just the Undo (Ctrl+Z) command
On Ubuntu, after creating a new file using vscode, it doesn't show up until I refresh the explorer manually. It's really frustrating. There was a key I changed in settings.json and everything worked fine after that:
"files.legacyWatcher": "on",
save, restart the vscode and be safe :)