CLAP Compiler
Build, run, test, and inspect C/C++ projects from VS Code without manually installing MinGW, Visual Studio Build Tools, CMake, or Ninja.
CLAP uses the clap-compiler Python package and its checksum-pinned Zig/Clang toolchain. The extension adds a fast editor surface on top of that toolchain: one-click builds, native tasks, compiler diagnostics, cancellation, dependency inspection, coverage reports, Test Explorer discovery for direct tests, debugger launch configurations, and project creation.
Requirements
Install CLAP once with Python 3.9 or newer:
python -m pip install clap-compiler
The extension invokes the configured clap executable directly. If it is not on PATH, set clap.executablePath in VS Code settings.
Quick start
- Open a C/C++ workspace or run CLAP: New Project from Template.
- Press the build button in the editor title area, click the CLAP status-bar item, or run CLAP: Build.
- Open CLAP: Run, CLAP: Test, or CLAP: Test Coverage Report when you need more than a compile.
No shell interpolation is used for command construction. Builds and tests show cancellable progress and terminate the child process tree on cancellation.
What the extension adds
- One-click build and run buttons for C/C++ editors,
clap.toml, and CMakeLists.txt.
- A Getting Started walkthrough that opens for new users and links directly to project creation, configuration, build, run, and test commands.
- A compact CLAP status-bar item that identifies the active workspace, starts a build, shows a spinner while work is running, becomes a cancellation action, and offers Run/Test follow-through after a successful build.
- Template-based project creation for C, C++, mixed, library, CMake, and test projects.
- Native VS Code tasks for bootstrap, build, run, tests, coverage, inspection, dependencies, toolchain information, configuration, and cleanup.
- GCC/Clang-style and MSVC-style compiler diagnostics in the native Problems view.
- Workspace-specific
compile_commands.json generation for Microsoft C/C++ IntelliSense, with a next-step prompt after writing workspace configuration.
- Multi-root workspace support: commands follow the active editor folder and independent roots may run concurrently.
- Dependency, lock, toolchain, coverage, and project inspection commands backed by the real CLAP CLI.
Validated UI evidence
These screenshots come from a real VS Code Extension Development Host running the extension against the real CLAP executable:
| Command surface |
Native tasks |
 |
 |
| Cancellable execution |
Compiler diagnostic |
 |
 |
| Test Explorer per doctest case |
Line-accurate failure |
 |
 |
Settings
| Setting |
Purpose |
clap.executablePath |
CLAP executable used by editor commands; defaults to clap. |
clap.showStatusBar |
Show or hide the compact CLAP project status item. |
The generated .vscode/tasks.json integration remains useful even without this extension. This extension is for users who also want editor commands, native diagnostics, cancellation, status integration, and one-click build/run actions.
Current limitations
- Multi-root command selection depends on which editor is active; cancellation of several concurrent commands uses the active editor workspace.
- The extension does not implement a language server; IntelliSense still comes from the recommended Microsoft C/C++ extension and generated
compile_commands.json.
- MSVC-style parsing is unit-tested, while end-to-end MSVC compiler validation requires a Windows/MSVC environment.
Development
cd editors/vscode
npm ci
npm test
xvfb-run -a npm run test:extension-host # fake-clap editor integration validation
xvfb-run -a npm run test:extension-host-real # real CLAP build/test/run/configure validation
xvfb-run -a npm run test:extension-host-multiroot # concurrent multi-root command/diagnostic validation
npm run package
test:extension-host validates command registration, task metadata, overlap rejection, cancellation, and diagnostics in a real VS Code extension host with a fake local executable. The real and multi-root host tests validate actual CLAP builds and concurrent workspace behavior. npm run package creates a local .vsix; Marketplace publication uses .github/workflows/publish-vscode.yml with GitHub OIDC Trusted Publishing and no stored PAT.