Skip to content

Editor setup

RITEG uses CMakePresets.json and exports a CMake compilation database, so both editor engines can be brought up from the repository root. The scripts below only edit machine-local files under .vscode/, which are git-ignored; .clangd is tracked and configures clangd for everybody.

clangd

Recommended. The llvm-vs-code-extensions.vscode-clangd extension reads the CMake compilation database, so code navigation agrees with the build.

  1. Configure a preset once, for example cmake --preset common-debug.
  2. Run ./setup_clangd.sh --preset common-debug on POSIX systems, .\setup_clangd.ps1 --preset common-debug in PowerShell or setup_clangd.bat --preset common-debug in cmd.exe. Without --preset the script picks the most recently configured build tree.
  3. Reload the VSCode window (Developer: Reload Window).

The script writes the clangd settings to .vscode/settings.json and copies build/<preset>/compile_commands.json to build/compile_commands.json. clangd only looks for a database upwards from a source file and in the build/ subdirectory of each directory it passes, so the copy is what serves riteg/ and deps/. Re-run the script after a reconfigure, otherwise the copy goes stale.

.clangd hides the precompiled header from clangd's include cleaner and forces C++20 when clangd parses a *.hh header on its own. On Windows with MSVC, start VSCode from a developer prompt (or make sure INCLUDE is set), because clangd has no other way to find the MSVC headers; with GCC, --query-driver lets clangd ask the compiler for its system includes.

Microsoft C/C++ IntelliSense

Run ./setup_intellisense.sh, .\setup_intellisense.ps1 or setup_intellisense.bat instead. The script writes .vscode/settings.json and .vscode/c_cpp_properties.json, whose include paths cover deps/*/include and the GLFW copy that FetchContent downloads into build/<preset>/_deps/ at configure time: configure a preset before running it. Both engines cannot be active at once; the script removes the settings of the other one.

Requirements

  • Python 3 for scripts/setup.py (the wrappers try py -3, then python3, then python, and skip the Microsoft Store aliases that only print an install message);
  • A configured preset, so a compilation database exists;