vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Indexing every time VS code is restarted, IntelliSense indexing is too slow for large C/C++ projects – suggest persistent cache and Git-aware incremental updates

Open Ma-Ike opened this issue 3 months ago • 29 comments

Environment

Version: 1.104.0 (user setup) Commit: f220831ea2d946c0dcb0f3eaa480eb435a2c1260 Date: 2025-09-10T06:46:18.035Z Electron: 37.3.1 ElectronBuildId: 12342881 Chromium: 138.0.7204.235 Node.js: 22.18.0 V8: 13.8.258.31-electron.0 OS: Windows_NT x64 10.0.22631

- C/C++ Extension Version:

C/C++: Version: 1.104.0 (user setup) Commit: f220831ea2d946c0dcb0f3eaa480eb435a2c1260 Date: 2025-09-10T06:46:18.035Z Electron: 37.3.1 ElectronBuildId: 12342881 Chromium: 138.0.7204.235 Node.js: 22.18.0 V8: 13.8.258.31-electron.0 OS: Windows_NT x64 10.0.22631

C/C++ Extension Pack: Identifier ms-vscode.cpptools-extension-pack Version 1.3.1 Last Updated 2025-02-24, 20:41:16

C/C++ Themes: Identifier ms-vscode.cpptools-themes Version 2.0.0 Last Updated 2022-11-07, 18:21:11

  • If using SSH remote, specify OS of remote machine: NO no remote connection to access this just on the same machine

Bug Summary and Steps to Reproduce

Bug Summary: Does this issue occur when all extensions are disabled?: Yes/No

VS Code Version: Version: 1.101.2 (user setup) Date: 2025-06-24T20:27:15.391Z Electron: 35.5.1 ElectronBuildId: 11727614 Chromium: 134.0.6998.205 Node.js: 22.15.1 V8: 13.4.114.21-electron.0 OS: Windows_NT x64 10.0.22631 Problem Summary

In large C/C++ projects (e.g. >1500 .c files, >6 GB source tree), IntelliSense in VS Code takes an extremely long time to index, sometimes up to 3h or more. This severely impacts productivity, especially when switching branches or restarting the editor.

Environment

VS Code: [1.101.2] C/C++ extension: ms-vscode.cpptools (v2.x) OS: Windows 10 / 11 Workspace type: Local repo Project size: ~6 GB, 1500+ C files Compiler: GCC + compile_commands.json provided Hardware: [e.g. 8-core CPU, 32GB RAM] Observed Behavior

When opening the workspace, IntelliSense starts re-indexing from scratch. This happens even if no files have changed. There's no apparent persistent cache between VS Code sessions. It uses a lot of CPU and RAM and slows down the entire system. No integration with Git (e.g. it re-indexes even if Git history is unchanged). Desired Behavior

I would like IntelliSense to behave more intelligently in large projects:

Persistent Index Cache Save the symbol index and reuse it across sessions – do not re-index the entire project from scratch when VS Code restarts. Clangd already supports this with its .clangd/index/ folder.

Git-Aware Incremental Indexing Integrate with Git to detect which files have changed between sessions or branch switches. This would allow VS Code to re-index only the changed files.

Smart Index Resume Indexing should resume from the last known state even if interrupted (e.g. via VS Code crash, or reboot).

Optional Index Directory Location Setting Allow users to specify a location where IntelliSense index data is stored – useful for SSDs, network drives, or project-specific cache directories.

Workarounds Tried

"C_Cpp.default.compileCommands" is correctly set. "C_Cpp.intelliSenseEngine": "Default" (also tried "Disabled" with clangd). "files.watcherExclude" is used to reduce load. "terminal.integrated.gpuAcceleration": "off" is set. Switching to clangd helps slightly but still re-indexes every time. Related Ideas

Similar to how clangd keeps a persistent index in .clangd/index cquery, ccls and others support persistent and incremental indexing Git-aware indexing is used in some LSPs and build systems (e.g. Bazel, Buck) Request

Please consider improving IntelliSense in large projects by:

Adding persistent indexing support Making the index cacheable across sessions Using Git or file-hash comparisons to do incremental re-indexing Providing users control over the index behavior via settings This would dramatically improve performance and usability for large embedded C/C++ projects.

Would be really good to have this fixed. regardless of what I try it helps very little or not at all. I gave some suggestions but if you have a better or a path forward then up to you mine are just suggestions here.

Steps to reproduce:

  1. open VS code and wait until the indexing is done
  2. close VS code
  3. Open VS code and see indexing is starting over

Expected behavior:

NOT to index everything every time VS code starts again.

Original post is here: 254508

Configuration and Logs

No logs is needed

Other Extensions

No response

Additional context

No response

Ma-Ike avatar Sep 12 '25 18:09 Ma-Ike