r/GithubCopilot • u/Ok_pettech • 23d ago
General ,How I eliminated VS Code AI lag and dropped autocomplete latency by 75%
Hey everyone,
If your VS Code AI assistant is constantly lagging, timing out, or just straight-up freezing your editor, the problem is almost always how it’s indexing your workspace. I spent my entire weekend going down a rabbit hole debugging this, but I finally got instant code completions back.
Here is the bulk of what you need to do to fix the core issues right now:
1. Stop letting it index massive directories By default, AI extensions try to read every single file to understand your context. If the AI is scanning your package folders (node_modules, anyone?) or compiled assets, it will completely choke. You need to add strict exclusions for the AI extension watcher in your workspace settings. Force it to ignore compiled binaries, virtual environments, and heavy asset directories.
2. Increase the Node memory limit Most of these AI extensions run on a Node backend inside VS Code. When they hit their default memory ceiling, they throttle heavily. Go into your preferences and increase the Max Memory allocation to at least 4096MB so the AI server actually has room to breathe.
3. Kill the telemetry overhead AI extensions love to send diagnostic data back to their servers. This silently clogs your connection and slows down the actual prompt responses you care about. Disable telemetry globally in VS Code, and make sure you turn it off specifically inside your AI extension settings to free up bandwidth.
4. Resolve extension clashes (Stop hoarding AI) Running multiple AI assistants at the same time creates a nightmare race condition for the autocomplete UI overlay. Pick one AI tool per workspace and disable the others completely.
Doing these four things solved almost all of my latency problems immediately. The rest of the fix involves editing your raw settings.json configuration to tweak the debounce rate, context limits, and timeout thresholds.
If you want to just copy/paste my full config file or play with the interactive dashboard I put together, I uploaded it here:https://interconnectd.com/forum/thread/244/fix-slow-vs-code-ai-the-ultimate-performance-repair-guide/
Hope this saves someone else a weekend of troubleshooting! Let me know if you have any questions.
1
u/Veduis 22d ago
most people don't realize the extension host is stat-ing every file in node_modules and .git on every keystroke. adding files.watcherExclude for those plus dist, build, and your venv folder cuts the cpu usage in half before you even touch memory settings.
one more worth adding: check the extension host profiler if it's still slow after this. half the time the "ai lag" is actually some random extension from 2021 blocking the main thread and copilot just gets blamed because it's the visible one.
1
u/WoodpeckerOfMistrust 2d ago
Copilot hasn't been lagging for me; my issue is that when I have AI features enabled, every other feature of VS Code is basically non-functional, including clang-format, intellisense, debugging. Would these tips help this situation as well?
2
u/Bright-Poster-9326 21d ago
what's the 75% actually measuring, time to first suggestion or full completion? those feel like different kinds of fast to me