Skip to content

feat(cmake): hybrid FileAPI ingestion, presets, target debugging, and CTest integration (#5) - #6

Merged
FunToHard merged 2 commits into
mainfrom
feat/cmake-modernization
Nov 7, 2026
Merged

FunToHard merged 2 commits into
mainfrom
feat/cmake-modernization

Conversation

@FunToHard

Copy link
Copy Markdown
Contributor

Closes #5

Summary

This pull request implements comprehensive CMake modernization for C/C++ Pro, introducing a hybrid intelligence architecture that combines instant zero-binary static parsing with full ingestion of modern CMake FileAPI, CMake Presets, target debugging, CTest runner, and single-file compilation.

Key Capabilities

1. Hybrid CMake FileAPI Ingestion (codemodel-v2)

  • Ingests .cmake/api/v1/reply/ artifacts (codemodel-v2, cache-v2, toolchains-v1) when available in configured build directories.
  • Extracts 100% ground-truth compiler flags, include paths, defines, sysroots, and target definitions without spawning external processes.
  • Gracefully falls back to C/C++ Pro's zero-binary static AST parser when a project is unconfigured or CMake has not yet run.
  • Watches .cmake/api/v1/reply/*.json for seamless auto-reload when external builds run.

2. CMake Presets Support (CMakePresets.json & CMakeUserPresets.json)

  • Native support for CMake Presets schema versions 1 through 9+ (CMake 3.19 through 3.31+).
  • Supports configurePresets, buildPresets, and testPresets with developer overrides in CMakeUserPresets.json.
  • Evaluates standard CMake macros (${sourceDir}, ${presetName}, ${generator}, ${hostSystemName}, ${pathListSep}, ${env:VAR}).
  • Commands: c-cpp-pro.cmake.selectConfigurePreset and c-cpp-pro.cmake.selectBuildPreset.

3. Target-Aware Launch & Debug Engine

  • Discovers executable targets from FileAPI artifacts and static declarations.
  • Active target selector widget on the status bar (c-cpp-pro.cmake.selectLaunchTarget).
  • Direct DAP debugging (c-cpp-pro.cmake.debugTarget) via lldb-dap, cppvsdbg, or gdb without manual launch.json authoring.
  • Direct execution in integrated terminal (c-cpp-pro.cmake.launchTarget) using native TerminalOptions.cwd.

4. CTest Integration in Test Explorer

  • Discovers CTest test suites via ctest --show-only=json-v1 or parsing CTestTestfile.cmake.
  • Integrates CTest tests directly into VS Code's native Test Explorer (vscode.tests).
  • Supports both Run and Debug test execution profiles.

5. Single-File Quick Compilation

  • Command and editor context menu action: c-cpp-pro.cmake.compileActiveFile.
  • Compiles the active source file in syntax-only / check mode (-fsyntax-only / /Zs) to verify syntax and template instantiations in seconds without whole-project linkage.

6. Multi-Compiler Problem Matcher

  • Line-by-line regex problem matcher for GCC, Clang, and MSVC compiler diagnostics.
  • Supports Windows drive letters (C:\...), POSIX paths, coordinates, and diagnostic error codes (e.g. C2065).
  • Streams diagnostics directly into vscode.DiagnosticCollection('c-cpp-pro-build').

7. AST-Assisted "Add to CMake Target" Refactoring

  • CodeAction provider (CMakeCodeActionProvider) offering quick refactorings for untracked workspace C/C++ files.
  • Modifies CMakeLists.txt inserting files into target_sources() or target declarations while preserving indentation.

8. Documentation

  • Updated wiki/Static-CMake-Integration.md covering the hybrid FileAPI architecture, presets, debugging, and command reference.

Verification

  • Comprehensive subagent code review conducted (verdict: PASS).
  • TypeScript typecheck (npm run check-types): 0 errors.
  • Unit test suite (npm test): 509 passing (100% pass rate).
  • Strict No Emojis rule maintained across all code, comments, docs, and commits.

@FunToHard
FunToHard merged commit 1e629a5 into main Nov 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: CMake Modernization - FileAPI, Presets, Target Debugging, and CTest Integration

1 participant