Skip to content

Commit b7c9780

Browse files
committed
took in feedback
1 parent afad556 commit b7c9780

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

package.nls.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,11 @@
251251
"cmake-tools.configuration.cmake.debugConfig.setupCommands.text.description": "Command to run.",
252252
"cmake-tools.configuration.cmake.debugConfig.setupCommands.description.description": "Description of the command.",
253253
"cmake-tools.configuration.cmake.launchConfig.markdownDescription": "Redirect the **CMake: Run Without Debugging** command (`cmake.launchTarget`) to either a VS Code task from `tasks.json` (`task` mode) or a custom external program (`program` mode). The active CMake target is still built first when `#cmake.buildBeforeRun#` is enabled, and its path is available via `${command:cmake.launchTargetPath}`. When set, this setting **fully replaces** `#cmake.debugConfig#`'s `args`, `cwd`, and `environment` on the launch path; provide equivalents inside `cmake.launchConfig` instead. The debug command (`cmake.debugTarget`) is unaffected. Only one of `task` or `program` may be set. When the delegated task itself depends on a CMake build (e.g. via `dependsOn`), consider setting `#cmake.buildBeforeRun#` to `false` to avoid building twice. When using `program`, the terminal lifecycle follows the `#cmake.launchBehavior#` setting (reuse, break-and-reuse, or new terminal).",
254-
"cmake-tools.configuration.cmake.launchConfig.task.description": "Name of a task from `tasks.json` to run instead of launching the built executable. Accepts either a bare string label or `{ \"name\": \"...\", \"type\": \"...\" }` to disambiguate when multiple providers register tasks with the same name.",
254+
"cmake-tools.configuration.cmake.launchConfig.task.description": "Name of a task from `tasks.json` to run instead of launching the built executable. Accepts either a bare string label or `{ \"name\": \"...\", \"type\": \"...\" }` to disambiguate when multiple providers register tasks with the same name. Mutually exclusive with `program`.",
255255
"cmake-tools.configuration.cmake.launchConfig.program.description": "Path to a custom program to run instead of the built executable. Supports `${command:cmake.launchTargetPath}` and other VS Code variable substitutions. Mutually exclusive with `task`.",
256-
"cmake-tools.configuration.cmake.launchConfig.args.description": "Arguments to pass to the custom `program`. Each entry is shell-quoted before being sent to the integrated terminal.",
257-
"cmake-tools.configuration.cmake.launchConfig.cwd.description": "Working directory for the custom `program`. Defaults to the directory of the built executable.",
258-
"cmake-tools.configuration.cmake.launchConfig.environment.description": "Environment variables to set when running the custom `program`. Array of `{ \"name\": ..., \"value\": ... }` objects, mirroring `cmake.debugConfig.environment`.",
256+
"cmake-tools.configuration.cmake.launchConfig.args.description": "Arguments to pass to the custom `program` (ignored in `task` mode). Each entry is shell-quoted before being sent to the integrated terminal.",
257+
"cmake-tools.configuration.cmake.launchConfig.cwd.description": "Working directory for the custom `program` (ignored in `task` mode). Defaults to the directory of the built executable.",
258+
"cmake-tools.configuration.cmake.launchConfig.environment.description": "Environment variables to set when running the custom `program` (ignored in `task` mode). Array of `{ \"name\": ..., \"value\": ... }` objects, mirroring `cmake.debugConfig.environment`.",
259259
"cmake-tools.launchConfig.task.notFound": "Task '{0}' referenced by cmake.launchConfig was not found.",
260260
"cmake-tools.launchConfig.task.executeFailed": "Failed to execute task \"{0}\" referenced by cmake.launchConfig: {1}",
261261
"cmake-tools.launchConfig.task.ambiguous": "Multiple tasks named '{0}' found; using the first. Specify 'type' in cmake.launchConfig.task to disambiguate.",
@@ -265,6 +265,7 @@
265265
"cmake-tools.launchConfig.debugConfigShadow.message": "cmake.launchConfig is set, so cmake.debugConfig.args, cmake.debugConfig.cwd, and cmake.debugConfig.environment will be ignored on the Run-Without-Debugging path. (cmake.debugConfig still applies when debugging.)",
266266
"cmake-tools.launchConfig.debugConfigShadow.openSettings": "Open Settings",
267267
"cmake-tools.launchConfig.debugConfigShadow.dontShowAgain": "Don't show again",
268+
"cmake-tools.launchConfig.task.ignoredFields": "cmake.launchConfig: args, cwd, and environment are ignored in task mode. These settings only apply when using \"program\".",
268269
"cmake-tools.projectStatus.launchConfig.viaTask": "(via task: {0})",
269270
"cmake-tools.projectStatus.launchConfig.viaProgram": "(via program: {0})",
270271
"cmake-tools.configuration.cmake.defaultVariants.overall.description": "Configure the default variant settings.",

src/cmakeProject.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,7 @@ export class CMakeProject {
911911
this.termCloseSub.dispose();
912912
this.launchTaskEndSub.dispose();
913913
this.launchTerminals.forEach(term => term.dispose());
914+
this.launchTerminals.clear();
914915
this.launchTaskExecutions.forEach(exec => exec.terminate());
915916
this.launchTaskExecutions.clear();
916917
for (const sub of [
@@ -3537,6 +3538,10 @@ export class CMakeProject {
35373538
* `presentation.panel`/`isBackground` settings.
35383539
*/
35393540
private async runLaunchAsTask(_executable: ExecutableTarget, cfg: LaunchConfig): Promise<void> {
3541+
if (cfg.args?.length || cfg.cwd || cfg.environment?.length) {
3542+
log.warning(localize('launchConfig.task.ignoredFields',
3543+
'cmake.launchConfig: args, cwd, and environment are ignored in task mode. These settings only apply when using "program".'));
3544+
}
35403545
const ref: { name: string; type?: string } =
35413546
typeof cfg.task === 'string' ? { name: cfg.task } : cfg.task!;
35423547
const all = await vscode.tasks.fetchTasks(ref.type ? { type: ref.type } : undefined);

src/ui/projectStatus.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,7 @@ class LaunchTarget extends Node {
11321132
}
11331133
}
11341134

1135+
/** Releases the `config.onChange('launchConfig', ...)` subscription registered in `initialize()`. */
11351136
dispose(): void {
11361137
vscode.Disposable.from(...this.disposables).dispose();
11371138
}

0 commit comments

Comments
 (0)