How to Troubleshoot High VS Code CPU Usage Caused by Extensions

A practical VS Code high-CPU troubleshooting guide: use Start Extension Bisect to quickly isolate problematic extensions, then optimize search and file watching settings.

When VS Code suddenly feels laggy, your fan spins up, and CPU usage stays high, the most common cause is usually not the editor itself, but extension conflicts or abnormal extension behavior.

This guide gives you a direct, actionable workflow to identify the issue quickly.

Start with the Fastest Method: Start Extension Bisect

Start Extension Bisect uses a binary search approach: in each round, VS Code temporarily disables half of your extensions and restarts. Based on whether the issue still appears, it narrows down the suspect list quickly.

Steps:

  1. Press Ctrl+Shift+P (macOS: Cmd+Shift+P) to open the Command Palette.
  2. Run Start Extension Bisect.
  3. After each restart, check whether high CPU usage and lag are still present, then choose Good now or This is bad.
  4. After several rounds, VS Code will show the likely problematic extension(s).

What to Do After You Find the Suspect

Once you identify the extension, handle it in this order:

  1. Update the extension to the latest version.
  2. If the issue remains, disable it for 1-2 days and observe.
  3. If alternatives exist, switch to a lighter extension.
  4. If you must keep it, review advanced settings and disable unnecessary real-time analysis, indexing, or file watching features.

Two Common “Amplifiers” You Might Overlook

Even if an extension is the root cause, these settings can amplify CPU load:

  1. Search scope is too broad
    If build output, dependency folders, and logs are included in global search, extensions and indexers may stay under continuous heavy load.

  2. File watching includes huge folders or symlinks
    Symlinks, cache directories, and generated folders can trigger large numbers of file events and force extensions to reprocess repeatedly.

You can trim scope in settings.json, for example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
  "search.exclude": {
    "**/node_modules": true,
    "**/dist": true,
    "**/build": true
  },
  "files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/node_modules/**": true,
    "**/dist/**": true
  }
}

Postmortem Tip

After isolating the issue, record three things: extension name, trigger scenario, and final fix.
That note will save time when you migrate your environment or rebuild your machine later.

Summary

For high VS Code CPU usage, the most effective path is to use Start Extension Bisect first, then tighten search and file watching scope.
Locate first, optimize second. It is faster and more reliable than randomly disabling many extensions.

记录并分享
Built with Hugo
Theme Stack designed by Jimmy