Add cmake.launchConfig setting for customizable run configurations#4916
Add cmake.launchConfig setting for customizable run configurations#4916hanniavalera wants to merge 4 commits into
Conversation
|
With any new feature, let's be verbose in the description of the PR and include screenshots of the feature. While I plan to checkout and try it out, it makes reviewing a little bit simpler when new UI is added. |
gcampbell-msft
left a comment
There was a problem hiding this comment.
Partial review, more review to come 👍
| } | ||
|
|
||
| dispose(): void { | ||
| this.launchTarget?.dispose(); |
There was a problem hiding this comment.
Curious on what about this needs to be disposed?
There was a problem hiding this comment.
From what I understood, it releases the config.onChange('launchConfig', ...) subscription registered in initialize() so the node stops reacting to setting changes after teardown, let me know if it makes sense!
|
|
||
| private updateLaunchConfigDescription(): void { | ||
| const launchCfg = treeDataProvider.cmakeProject?.workspaceContext.config.launchConfig; | ||
| if (launchCfg?.task) { |
There was a problem hiding this comment.
Are task and program mutually exclusive? If so, we should make sure we document which we prefer
There was a problem hiding this comment.
Yes they are! I added on to task in addition to the program description to make note of this!
| this.disposeEmitter.fire(); | ||
| this.termCloseSub.dispose(); | ||
| this.launchTaskEndSub.dispose(); | ||
| this.launchTerminals.forEach(term => term.dispose()); |
There was a problem hiding this comment.
Should we also clear the launchTerminals?
There was a problem hiding this comment.
Thanks for calling this out! I now added this.launchTerminals.clear() after the dispose loop, matching the pattern used right next to it for launchTaskExecutions, does that make sense to you?
| "type": "string", | ||
| "description": "%cmake-tools.configuration.cmake.launchConfig.program.description%" | ||
| }, | ||
| "args": { |
There was a problem hiding this comment.
Do the args and following properties apply to both scenarios of task and program? I imagine that the task itself has these already, how is this handled?
There was a problem hiding this comment.
They only apply to program mode as VS Code tasks already own those fields. I've tightened the descriptions to say "(ignored in task mode)" and added a defensive log.warning in runLaunchAsTask if a user sets them anyway, so the override is visible without being disruptive.
@gcampbell-msft sounds fair, forgot to put the screenshots up, will do! |
63d70bc to
b7c9780
Compare
- Introduced `cmake.launchConfig` to allow users to customize the "Run Without Debugging" command, enabling delegation to a VS Code task or a custom program. - Updated documentation and changelog to reflect this new feature. - Added unit tests to ensure correct functionality and regression coverage for the new launch configuration.
b7c9780 to
36b1c29
Compare
This pull request introduces a major new feature to VS Code CMake Tools: the ability to customize the "Run Without Debugging" command via a new
cmake.launchConfigsetting. This allows users to delegate launching to a VS Code task or to run a custom program (such as a firmware flashing tool), with support for argument, environment, and working directory customization. The implementation includes schema, documentation, and UI/logic changes, as well as telemetry and user guidance for the new behavior. Suggested by @positron96 and addresses #4904Key changes include:
New Feature: Customizable Run Without Debugging
cmake.launchConfigsetting, allowing users to configure "Run Without Debugging" to either delegate to a VS Code task (task) or run a custom program (program). This supports variable substitution and custom arguments, environment, and working directory. [1] [2] [3] [4]Core Implementation and Lifecycle Management
CMakeProjectto handle the new launch modes, including running a VS Code task or a custom program instead of the default executable, with proper terminal/task lifecycle and cleanup. [1] [2] [3] [4] [5]Configuration and API Updates
launchConfigproperty and expose it through the configuration reader. [1] [2] [3]User Guidance and Documentation
cmake.launchConfigandcmake.debugConfigfields are set (as the latter are ignored for the launch path), and improved error/warning messages for ambiguous or missing tasks. [1] [2]These changes provide advanced users and embedded developers with much more flexibility for customizing their build/run workflows directly from CMake Tools.