Visual Studio Code Destroyed all my files - visual-studio-code

I have been using visual studio code for about a year now. Recently I went to save one of my files and visual studio code gave me the error message this file conflict with a previous version. I clicked on the error and it presented me with a screen show the differences. I turned out I had added a line at the top importing defining a new constant. When I clicked override visual studio code presented me with a blank file. I went to look at my files and found that every file I have every worked on in the program has been changed to a blank file. Now whenever I try to save a file nothing happens, and I can't close tabs. I use a macbook if that helps in any way. Does anyone know how I could retrieve my files and how to prevent this prom happening again.
Edit: this applies to all my files not just ones associated with this project.

Related

Randomly the Save menu item greyed out when editing files in VS Code

I encounter the "Save" and "Save As" menu items greyed out randomly and regularly while editing files in VS Code. Been happening for a few years. Most of the time it's while I'm editing Golang code but it has happened for other file types. If I click on the x to the right of the file name tab for the open file, I then get the option to save the file. Ditto if I try and close VS Code.
So VS Code knows there are unsaved changes. Closing VS Code completely and restarting it "fixes" the issue until the next time. Did a search and I don't see any "recent" issues like this that others have experienced. Running on macOS. Happened under Big Sur, Monterey and now on Ventura. Currently running VS Code 1.72.2. I tried to narrow it down by disabling some extensions but it still happens.
Tried removing extensions. Still happens. Uninstalled and re-installed VS Code.

Settings.json keeps opening in Visual Studio Vode

I have this weird issue in Visual Studio Code (v1.67.0 (Universal) on Mac) where the editor keeps opening Settings.json
It says something has changed in the file, however I can't figure out what it is. After saving again and closing the file reopens itself after a while and says it has been modified.
When comparing, no changes in the file are visible. I tried deleting the cache as mention in this Stack Overflow topic however that didn't make a difference.
Anyone else experiencing the same issue?
Cheers,
Allard

Visual Studio Code Save All button issue

Visual Studio Code Save All button is always enabled even without any file changes. How can we solve this issue? Ideally it should be grayed Out if no file changes are there in the workspace.
It's an intentional feature, just in case someone is not sure if they saved their files, VS Code will always show it to prevent closing without saving (besides the exit prompt).
Now, if for some reason they decided to change this, it would we worse, as people are used to the always blue button.

vscode "applying code action organize Imports"

Currently got an annoying issue with VS and saving ts files.
every time I save a ts file I get a little popup in the bottom right telling me its "applying code action organize Imports".
I've tried uninstalled VSCode, removing all extensions, deleting the code folder in Roaming. As far as I can tell all my user settings are blank and it should be back to a clean install of VSCode. I've tried looking in the settings for something similar, even adding this to my settings.
{
"editor.codeActionsOnSave": {
"source.organizeImports": false
}
}
However, I'm still getting the same message on save and its restructuring the imports.
I've got vs code installed on another 2 machines and don't get the same issue.
Any ideas?
Turns out the folder I was opening had its own custom .vscode folder with its own settings.json which had the organizeImports setting enabled. So no matter what I did to my local settings file this one was always overriding it and nothing was showing up within VS directly.
I had forgotten to select a Python interpreter in vscode. Once I did this, the pop up on bottom right telling saying its "applying code action organize Imports" stopped appearing. This solved it for me.

Code not showing up when opening Visual Studio from Unity

I am a newcomer when it comes to Unity. I was following along with this online course. At one point, I had to write a C# script. So, I created one and doubled clicked it to edit it with Visual Studio. However when Visual Studio opened, all I could see was a essentially a blank screen. I couldn't see any code. Does anyone know the fix?
Thank you
Did you create it inside like this ... In Unity>ProjectWindow>AssetsFolder>RightClick>Create>C#Script.Then double click to open it.It will open up a script containing Start() and Update() method.If you could not find this.Restart and try.This is to test and try script for Unity scripting.
So this is way too late for the original post but maybe someone else will find this useful. So you did everything you were supposed to and even see the automated code with everything it should have in the inspector, but when you go and run the code whether clicking the actual script in the asset>scripts or clicking the open button in the inspector the same problem persists... blank uneditable screen.
I think you may just need to run updates on Visual Studio and/or if on a Mac maybe you need to log back into Microsoft. To do this just click the Visual Studio tab and click check for updates. Usually, you will also see an update suggestion in the top center of the screen. Run the updates and let it restart visual studio. Once you reopen visual studio at this time if you are on a Mac it should ask you to log into Microsoft. Your code might show up now.