VS Code Setup Guide¶
This guide defines the boundary between shared VS Code settings and developer-specific settings. The repository uses clangd as the default C++ language service. CMake Tools is responsible for CMake configuration, builds, and target execution; the two tools must not provide competing diagnostics, completion, and navigation.
Configuration ownership¶
| Configuration | Location | Owner |
|---|---|---|
CMake source and build/ directories |
.vscode/settings.json |
Shared repository configuration |
Generation of build/compile_commands.json |
.vscode/settings.json |
Shared repository configuration |
| Build-output search and watcher exclusions | .vscode/settings.json |
Shared repository configuration |
| C++ compile flags | build/compile_commands.json and .clangd |
Generated by the build; shared entry point |
| C++ language service | llvm-vs-code-extensions.vscode-clangd and .clangd |
Repository default |
| Recommended CMake Tools, Qt QML, and other extensions | .vscode/extensions.json |
Shared repository configuration |
| Fonts, theme, cursor, scrolling, auto-save, and terminal size | VS Code User Settings | Developer-specific |
| Qt, compiler, and clangd executable paths | Environment variables, VS Code User Settings, or a Git-ignored local workspace | Developer-specific |
.vscode/c_cpp_properties.json was removed because it duplicated the configuration provided by clangd, CMake Tools, and compile_commands.json.
From a clean clone¶
- Install VS Code and install the recommended CMake Tools, clangd, Qt QML, Python, YAML, GitHub Actions, and Markdown extensions.
- Follow the local build guide to prepare the project
.venv, Qt 6.6+, CMake, and a compiler. - Open the repository root. CMake Tools will configure
build/using the shared settings and request generation of the compilation database. - Run the project-defined environment check and build:
.venv/bin/python tools/python/build_project.py --check
.venv/bin/python tools/python/build_project.py --test
On Linux/macOS, set Qt6_DIR, CMAKE_PREFIX_PATH, and PATH to the project-specific Qt installation. On Windows, set the corresponding variables for the local Qt installation. Do not commit these paths.
Machine-specific paths¶
Environment variables¶
This is the path supported by the project build tools. Set the variables in the terminal before starting VS Code, or configure them as user-level operating-system environment variables. Do not rely on shell ~ expansion and do not commit absolute paths:
export Qt6_DIR=/your/qt/6.10.x/gcc_64/lib/cmake/Qt6
export CMAKE_PREFIX_PATH=/your/qt/6.10.x/gcc_64
export PATH=/your/qt/6.10.x/gcc_64/bin:$PATH
On Windows, use the actual local path, such as C:\Qt\6.10.x\msvc2022_64, in user environment variables instead of copying it into the shared settings.json.
Git-ignored local workspace¶
If CMake Tools or clangd needs machine-specific paths, create .vscode/EasyKiConverter.local.code-workspace locally. Workspace files in this directory are ignored by .gitignore. Do not create settings.local.json; VS Code does not automatically merge that file.
The following is a structure example; replace every path with a real local path:
{
"folders": [{ "path": ".." }],
"settings": {
"cmake.configureEnvironment": {
"Qt6_DIR": "/your/qt/6.10.x/gcc_64/lib/cmake/Qt6",
"CMAKE_PREFIX_PATH": "/your/qt/6.10.x/gcc_64"
},
"clangd.path": "/your/llvm/bin/clangd"
}
}
Windows, macOS, and Linux use different path formats; /your/... is only a placeholder. Never hard-code compiler, Qt, or clangd absolute paths in shared repository settings.
Requirements for C++ F12 navigation¶
F12 navigation is provided by clangd and requires:
- the recommended
llvm-vs-code-extensions.vscode-clangdextension; - a successful CMake configure that generates
build/compile_commands.json; .clangdfinding that database throughCompilationDatabase: ./buildfrom the repository root;- the source or test file being present in the compilation database with its compile flags.
If navigation is stale, rerun the project build tool or reconfigure in CMake Tools, then restart the clangd index. Do not enable cpptools IntelliSense at the same time. If a personal setup must use cpptools, select it in the local workspace and disable clangd there so both language services do not report diagnostics concurrently.
The repository does not verify F12 navigation inside VS Code automatically; the result depends on the developer's installed extensions, compiler, and local Qt environment.
Scope of shared settings¶
The repository shares only CMake paths, compilation-database generation, file associations, encoding, and build-output exclusions. Editor appearance, interaction preferences, auto-save, and toolchain paths belong to the developer and should remain personal settings.