Microsoft Visual Studio Code freezes can be extremely frustrating. I experienced it and spent hours looking for solutions.
The result is this comprehensive list of every solution I found to solve the freezing VSCode problem!
There can be multiple origins to the freeze, so I suggest that you try multiple of these solutions until the problem disappears.
Each worked for at least 1 person, and there is a link to the source for each. Hoping that it will solve your problem!
- Close programs that might interact your workspace's files
- Disable useless or seemingly conflicting extensions
- Known-to-help settings changes
- Free up VSCode detection watcher
- Disable VSCode use of the GPU
- Disable Hardware acceleration of web browsers
- Clear some RAM for VSCode
- Use proprietary GPU Drivers
- Update NVidia Drivers
- Uninstall Git for Windows & reinstall/update Git
- Reinstall VSCode
- Make sure you meet the requirements to run VSCode
- If VSCode freezes only when you delete a file/folder
- Still freezing ? A last resort solution
You found another working solution? Please share it with others here!
VSCode regularly accesses your files. So if you have other programs that access to your files at the same time, it might cause issues.
Watch for :
- Google Drive / iCloud & others cloud sync services. They can try to synchronize your files when you have VSCode open. Source
- External auto code compilers/minifyers
- Other IDEs (like one from Jetbrains).
- Any file editor with one of your workspace's files opened.
- Windows Defender : you can add an exclusion to tell it to stop scanning your workspace's folder. It is recommended for similar IDEs. Source
Be sure to disable them when you use VSCode.
Often time, an extension is the root cause.
Try to figure out if 2 extensions are :
- using the same files (Example : 2 extensions that compile the same file)
- linting/formatting/making suggestions for the same language (2 CSS "suggestion extensions for example)
Specific extensions linked to freezes : TSLint Source, PHP IntelliSense Source, IntelliCode [Source : was causing freezes for me]
Finally you can try to disable all extensions, and re-activate them one-by-one to identify the ones that are probably linked to the freezes.
Changing specific settings seems to remove the freezes :
- Git autorefresh
Go in File > Preference > Settings
Type Git autorefresh
in the search bar
And disable it. Source
You can still use git, you simply have to click the "refresh arrow" in the git panel to update the file list.
- Terminal Integrated Renderer
Go in File > Preference > Settings
Type terminal.integrated.rendererType
in the search bar
And set it to dom
. Source
- It may also help to disable the
Autosave
setting in theFile
menu :
This removes the very practical Autosaves. You will have to save CTRL/CMD + S
after you modify files.
Two ways to do this :
- Empty your folder of unused files and folder
This is because VScode watches constantly all your files for modifications. It can take up much RAM & this might be the source of Freezes.
- Or add exceptions to the VSCode File Watchers
Go in File > Preference > Settings
Type files.watcherExclude
in the search bar
Add a line and enter Globbing patterns (the same language as the .gitignore
file! Quicksheet here) to exclude specific files or folders.
Once you are finished, copy them, type files.exclude
in the search bar
And add the same lines there!
As an example, I use this list for both :
**/.git
**/.svn
**/.hg
**/CVS
**/.DS_Store
**/node_modules
**/.firebase
**/.git/objects/**
**/.git/subtree-cache/**
**/node_modules/**
This ignores files that are commonly not useful to watch.
This has been reported to work, but can be trickier.
On windows the simplest & most durable way to do this is to modify the target of the VSCode shortcut (here's how to do this)
And add --disable-gpu
at the end of the line. Make sure you have 1 space between the last character of the shortcut and the --
. Source
If you start VSCode from the commandline you can use : code --disable-gpu
If the issue is happening when you use Chrome, look into Chrome's settings:
Go in Preferences > Advanced> System
And turn off Use hardware acceleration when available
Source 1, 2
As Firefox and other browser can use GPU as well, you might as well disable it too.
- Other browsers : Many browsers are based on Chrome so you can try the directions above. Else search for your browser.
- Guide for firefox
VSCode freezes are often linked to limited RAM.
Make sure to close :
- Unused programs
- Unused tabs in web browsers
- RAM-hungry softwares (video games, video editing other IDEs)
To clear RAM for VSCode and see if it solves the problem.
As a final world you can also limit the opened tabs in VSCode to salvage some more RAM.
If you use the "Nouveau" Nvidia GPU Driver, it seems like switching back to proprietary driver can solve the problem. Source
Has also helped people solve the problem. Source
It can also solve the problem as Git for Windows seems to consume much more RAM than plain Git. Source
As a last resort, you can uninstalled VSCode and reinstall it, best without any extension. Source
VSCode is not a entireley lightweight. Here are its requirements
Minimum : 1.6 GHz processor, 1GB of RAM and 200 MB disk space.
My estimate to ensure a smooth running experience : 3.5 GHz processor, 8 GB RAM and 1 000 MB disk space.
If your computer does not meet its requirements it might be best to switch to another code editor or upgrade your PC. Source
If you have many files (1000+), sometimes disabling git.autorefresh
is not enough. Source 1, 2
If you already tried everything above and VSCode still freezes :
Go in File > Preference > Settings
Type git.enabled
in the search bar
And disable it.
Unfortunately this removes the very practical & useful Git integration in VSCode. But if it allows you to work it can be worth it.
You found another working solution? Please share it here to help others !