Fixing VS Code UI Unresponsiveness Caused by GitHub Copilot Extension
This article shows a simple solution to a problem that doesn’t seem to be adequately documented: VS Code UI lags, freezes, and delays caused by the GitHub Copilot extension.
Problem: VS Code UI Becoming Slow
Having worked on a Python project for a while, I noticed that VS Code’s UI was frequently freezing for seconds at a time. This was happening in various places of the UI: the editor itself but also in the GitHub Copilot Chat window. Copilot also seemed to be taking more and more time getting ready to answer, and the extension-host
process would fully saturate one CPU core for long periods of time.
Solution: Clear Workspace Chats
VS Code Process Explorer
I won’t bore you with a description of the many things I tried to find the root cause of the UI delays. Suffice to say that along the way I found out about the useful Process Explorer feature of VS Code that may be useful to identify misbehaving extensions. It didn’t help in this case, unfortunately, as the often high CPU usage wasn’t caused by an extension process but by the extension host process itself.
chatSessions and chatEditingSessions Directories
Now on to the actual solution. Looking at the size of VS Code’s directories in the home (user profile) folder, I noticed two directories that contained very large JSON files:
%AppData%\Code\User\workspaceStorage\<WORKSPACE-ID>\chatSessions
%AppData%\Code\User\workspaceStorage\<WORKSPACE-ID>\chatEditingSessions
The chatSessions
and chatEditingSessions
directories contain the current GitHub Copilot chat which, apparently, is continued across VS Code restarts until you manually start a new chat. That explains why the JSON files found there can grow to hundreds of megabytes in size.
Fix the UI Delays
To fix the UI delays, press Ctrl + Shift + p
and execute the command Chat: Clear All Workspace Chats. This creates a new, empty, chat which fixes the UI unresponsiveness.
Note the following:
- You may have to execute the above command multiple times for the huge existing JSON files in
chatSessions
to actually be deleted. - Existing files in
chatEditingSessions
don’t seem to be deleted. You may want to clear older subdirectories manually.