Provides per-file IntelliSense configurations to Microsoft's C/C++ extension (CppTools) from a CMake compilation database. This can solve some larger projects causing stalls and load issues with the CppTools extension. It uses the CppTools custom configuration provider API to supply compiler settings for each file when CppTools requests IntelliSense information.
The loader accepts standard compilation database entries using either arguments or command. Entry-relative paths are resolved from the entry's directory, Windows and POSIX command quoting are supported, and compiler options not mapped to a dedicated CppTools field are forwarded through compilerArgs.
Configuration
| Setting |
Default |
Description |
compile-commands-cpptools-provider.compileCommandsPath |
./compile_commands.json |
Path to the compilation database. Relative paths are resolved beside the .code-workspace file, or from the workspace folder when no workspace file is open. Absolute paths are used as written. |
C_Cpp.default.configurationProvider |
None |
Selects this extension as the CppTools configuration provider. Set it to mojang-studios.compile-commands-cpptools-provider if CppTools does not select the provider automatically. |
For example, add the following to the workspace's .vscode/settings.json:
{
"compile-commands-cpptools-provider.compileCommandsPath": "./build/compile_commands.json",
"C_Cpp.default.configurationProvider": "mojang-studios.compile-commands-cpptools-provider"
}
Only one compilation database is loaded. The configured file is watched and reloaded when it changes. Use a relative or absolute filesystem path; VS Code variable expressions such as ${workspaceFolder} are not expanded.
Provider API
Microsoft's vscode-cpptools API documentation and provider example shows how an extension registers a CustomConfigurationProvider, signals that it is ready, and notifies CppTools when configurations change. In this extension, that lifecycle is implemented by CppToolsConfigurationProvider and activate in extension.js.