Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Toggle debug configurations by CMake ToolsNew to Visual Studio Code? Get it now.
Toggle debug configurations by CMake Tools

Toggle debug configurations by CMake Tools

SR_team

|
169 installs
| (0) | Free
Toggle debug configurations based on CMake preset or kit
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

vscode-toggle-debug-options-by-cmake

A VSCode extension that automatically toggles debug configurations in launch.json based on the selected CMake preset and build kit.

Features

  • Automatically updates the presentation.hidden property in launch.json based on matcher rules
  • Supports 6 matcher types: preset-include, preset-match, kit-include, kit-match, include, match
  • Worktree-aware: updates pause while the window is unfocused, and a presentation.cmakeState marker (written only for symlinked launch.json) lets each worktree restore its own hide status when it gets focus back

Requirements

  • A compatible CMake Tools extension (default: ms-vscode.cmake-tools). You can use any fork — see Configuration below.
  • A project configured with CMake presets or build kits

Configuration

Setting Type Default Description
toggleDebugOptionsByCmake.cmakeExtensionId string "ms-vscode.cmake-tools" Extension ID of the CMake Tools extension to integrate with. Change this to use a fork. The new extension is resolved immediately without requiring a window reload.
toggleDebugOptionsByCmake.pauseUpdatesWhileUnfocused boolean true Pause launch.json updates while this window is unfocused. Deferred updates run on the next focus gain, after re-reading the current CMake selection. Disable to keep updating launch.json even when the window is not focused.

Using a CMake Tools fork

Set the setting to your fork's extension ID:

{
  "toggleDebugOptionsByCmake.cmakeExtensionId": "your-publisher.cmake-tools-fork"
}

The integration hot-swaps to the new extension as soon as you save the setting — no window reload needed.

Usage

  1. Install this extension.
  2. Open a project with CMake presets or build kits.
  3. The extension will automatically toggle the visibility of debug configurations in launch.json to match your selection.

Matcher Types

The extension uses matchers to determine whether a debug configuration should be shown or hidden. You can define these matchers in your launch.json file under each configuration's presentation.cmake array.

Available matcher types:

Matcher Type Description
preset-include Shows the configuration when the current CMake preset name includes the specified value
preset-match Shows the configuration when the current CMake preset name matches the specified regex pattern
kit-include Shows the configuration when the current CMake kit name includes the specified value
kit-match Shows the configuration when the current CMake kit name matches the specified regex pattern
include Shows the configuration when either the preset or kit name includes the specified value
match Shows the configuration when either the preset or kit name matches the specified regex pattern

Examples

Show a configuration only for Debug preset

{
  "configurations": [
    {
      "name": "Debug Application",
      "type": "cppdbg",
      "request": "launch",
      // ... other debug configuration properties
      "presentation": {
        "cmake": [
          {
            "type": "preset-include",
            "value": "Debug"
          }
        ]
      }
    }
  ]
}

Show a configuration for any GCC kit

{
  "configurations": [
    {
      "name": "GCC Debug",
      "type": "cppdbg",
      "request": "launch",
      // ... other debug configuration properties
      "presentation": {
        "cmake": [
          {
            "type": "kit-match",
            "value": "GCC.*"
          }
        ]
      }
    }
  ]
}

Show a configuration for multiple conditions (Unix or Linux)

{
  "configurations": [
    {
      "name": "Unix/Linux Launch",
      "type": "cppdbg",
      "request": "launch",
      // ... other debug configuration properties
      "presentation": {
        "cmake": [
          {
            "type": "match",
            "value": "(unix|linux)"
          }
        ]
      }
    }
  ]
}

Known Limitations

  • CMake variants are not supported (only presets and kits are supported)
  • Shared launch.json (symlinked across git worktrees): the focused window owns the visible state — a presentation.cmakeState marker under each matched configuration records which selection it reflects, and on focus regain the worktree re-applies its own selection if the marker says the file was rewritten elsewhere. Two windows visible on screen at the same time can still race (last write wins)

License

This project is licensed under the MIT License.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft