How to fix sluggish performance in Visual Studio Code
February 16, 2020
TL;DR One of your plugins is causing the problem, use the divide and conquer strategy to find it.
If you are like me, and many others, you have experienced terrible performance in Visual Studio Code. The performance has been bad enough to cause me to switch away from VS Code more than once.
I recently came back to VS Code with the intention of figuring out the problem, and I did just that. Now I want to tell you how to do the same, since it completely restored my faith in VS Code.
The Solution
I started by disabling all of my plugins. As I suspected it would, the problem disappeared. My next step was to “divide and conquer” the problem. I enabled half of my plugins, and the problem did not come back.
Since the problem did not return, I knew the problem would be one of the remaining plugins I had not enabled. I disabled all of the plugins again, then enabled the other half. The problem returned, confirming my assumptions.
I then continued to divide and conquer smaller and smaller groups of the extensions, until I was able to identify one plugin that caused the performance issues to return and go away, depending on whether the extension was enabled or not.
In my case, it was a plugin which automatiically imports Javascript modules when they are used in a file.
Why?
If an extension has code which will not perform well, it will affect the whole editor. This is a good reminder to install extensions cautiously and try them out one-by-one. Otherwise, it becomes difficult to identify which plugin is problematic.