From a67874597085734fc93008c4e9dbca8c6765877b Mon Sep 17 00:00:00 2001 From: Ian G Date: Tue, 5 Mar 2024 11:24:30 +0900 Subject: [PATCH] outputToNewTerminal settings option --- package.json | 7 ++++++- src/services/taskfile.ts | 2 +- src/utils/settings.ts | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index cd2828d..6f10fc2 100644 --- a/package.json +++ b/package.json @@ -288,6 +288,11 @@ "default": "output", "description": "Where to print the output of tasks. Note that the output panel does not support ANSI colors." }, + "outputToNewTerminal": { + "type": "boolean", + "default": false, + "description": "When using outputTo=terminal whether to use a new Terminal instance or reuse the last instance." + }, "checkForUpdates": { "type": "boolean", "default": true, @@ -354,4 +359,4 @@ "semver": "^7.5.0", "strip-ansi": "6.0.1" } -} +} \ No newline at end of file diff --git a/src/services/taskfile.ts b/src/services/taskfile.ts index e68de63..0871f31 100644 --- a/src/services/taskfile.ts +++ b/src/services/taskfile.ts @@ -225,7 +225,7 @@ class TaskfileService { if (settings.outputTo === "terminal") { log.info(`Running task: "${taskName} ${cliArgs}" in: "${dir}"`); var terminal: vscode.Terminal; - if (vscode.window.activeTerminal !== undefined) { + if (vscode.window.activeTerminal !== undefined && settings.outputToNewTerminal === false) { terminal = vscode.window.activeTerminal; } else { terminal = vscode.window.createTerminal("Task"); diff --git a/src/utils/settings.ts b/src/utils/settings.ts index 805fd6b..4b5586e 100644 --- a/src/utils/settings.ts +++ b/src/utils/settings.ts @@ -6,6 +6,7 @@ class Settings { public updateOn!: string; public path!: string; public outputTo!: string; + public outputToNewTerminal!: boolean; public checkForUpdates!: boolean; public treeNesting!: boolean; public treeSort!: string; @@ -29,6 +30,7 @@ class Settings { this.updateOn = config.get("updateOn") ?? "change"; this.path = config.get("path") ?? "task"; this.outputTo = config.get("outputTo") ?? "output"; + this.outputToNewTerminal = config.get("outputToNewTerminal") ?? false; this.checkForUpdates = config.get("checkForUpdates") ?? true; this.treeNesting = config.get("tree.nesting") ?? true; this.treeSort = config.get("tree.sort") ?? "default";