I'm sorry about the strange title but hopefully a GIF of what is happening can help. visual studio code colors stop working when I begin to edit
The issue: Whenever I load a C# script into visual studio code and begin to edit the script, the script loses its correct color coding. It loads with everything correctly up until I edit it, and as soon as I begin to edit, it loses the color. Another strange behavior that I encountered happened when I used Unity's Random.Range() function which then caused Visual Studio Code to import Systems.Numeric automatically at the top of the script.
Up until a few weeks ago I had never had any issues whatsoever. I installed an update for Visual Studio Code right around the time of this issue but other than that, everything else is the same.
I haven't been able to get much help with this issue anywhere over the past few weeks but I was able to find some leads that fixed the issue for a few minutes before breaking again.
These solutions that didn't work included
- a full reinstall of visual studio code (deleting all extensions, all hidden folders, and visual studio code itself)
- Restarting Omnisharp inside Visual Studio Code
- Reinstalling the Visual Studio Code packages inside the Unity Package Manager and regenerating the project files inside Unity
Solutions I haven't tried because I can't figure out how included
- Reverting Visual Studio Code to a past version (I can't remember which version I was on before updating and am worried I'll either go too far back or not far enough to fix the issue)
If anyone has encountered this before, has any idea on how to fix this, or could point me in a general direction for solving this issue, I would greatly appreciate it! Thanks!
additional information: Unity Editor version 202.3.18f1 Visual Studio Code version 1.81.1
What happened trying the solutions
a full reinstall of visual studio code (deleting all extensions, all hidden folders, and visual studio code itself) Result: worked for a few seconds before losing all color and continuing to import libraries I did not want
Restarting Omnisharp inside Visual Studio Code Result: Nothing changed, same issue as before. Would load properly then upon editing, cease working.
Reinstalling the Visual Studio Code packages inside the Unity Package Manager and regenerating the project files inside Unity Result: Nothing changed, same issue as before. Would load properly then upon editing, cease working.
edit: adding the Help: About output
Version: 1.81.1 (Universal) Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794 Date: 2023-08-09T22:20:33.924Z Electron: 22.3.18 ElectronBuildId: 22689846 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Darwin x64 19.6.0