microsoft / microsoft/vscode-cmake-tools

FR: Make it easier to setup a launch configuration with CMake Tools

Open
#3,742 3 comments 1 reaction 0 assignees View on GitHub
enhancement Feature: debug/launch
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Feature Request

When CMake Tools is present and the user is creating a debug configuration in `launch.json`, make it easier to configure a CMake provided target:

```json5
// Resolved by CMake Tools:
"program": "${command:cmake.launchTargetPath}",
```
This could be inserted (semi-)automatically in the `launch.json` configuration (with or without user prompt). So if a user is creating a CMake based project, having this setup would be a nice QoL improvement, which isn't as obvious if the user is not familiar with the details. It will be great if the extension promotes this option.

Maybe this also:

```json5
"environment": [
{
// add the directory where our target was built to the PATHs
// it gets resolved by CMake Tools:
"name": "PATH",
"value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
},
```

Taken from:

https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/debug-launch.md

```json5
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
// Resolved by CMake Tools:
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
// add the directory where our target was built to the PATHs
// it gets resolved by CMake Tools:
"name": "PATH",
"value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
},
{
"name": "OTHER_VALUE",
"value": "Something something"
}
],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
```

Contributor guide

Open the contributing guide

Research direction

Start with docs/debug-launch.md and the launch.json example referenced in the issue to understand the existing CMake Tools substitutions. Trace where launch configurations are created or assisted, then define completion as making the CMake target path available in a debug configuration, with the optional PATH setup handled consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript, vscode
Domain
developer-experience, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.