提交 298a3671 编写于 作者: A Alex Ross

Global tasks don't need a workspace root

Fixes #63951
上级 2e339afe
......@@ -253,7 +253,7 @@ namespace TaskSourceDTO {
export function to(value: TaskSourceDTO, workspace: IWorkspaceContextService): ExtensionTaskSource {
let scope: TaskScope;
let workspaceFolder: IWorkspaceFolder;
if (value.scope === void 0) {
if ((value.scope === void 0) || ((typeof value.scope === 'number') && (value.scope !== TaskScope.Global))) {
if (workspace.getWorkspace().folders.length === 0) {
scope = TaskScope.Global;
workspaceFolder = undefined;
......
......@@ -32,7 +32,7 @@ import { IOutputService, IOutputChannel } from 'vs/workbench/parts/output/common
import { StartStopProblemCollector, WatchingProblemCollector, ProblemCollectorEventKind } from 'vs/workbench/parts/tasks/common/problemCollectors';
import {
Task, CustomTask, ContributedTask, RevealKind, CommandOptions, ShellConfiguration, RuntimeType, PanelKind,
TaskEvent, TaskEventKind, ShellQuotingOptions, ShellQuoting, CommandString, CommandConfiguration, RerunBehavior
TaskEvent, TaskEventKind, ShellQuotingOptions, ShellQuoting, CommandString, CommandConfiguration, RerunBehavior, ExtensionTaskSource, TaskScope
} from 'vs/workbench/parts/tasks/common/tasks';
import {
ITaskSystem, ITaskSummary, ITaskExecuteResult, TaskExecuteKind, TaskError, TaskErrors, ITaskResolver,
......@@ -970,17 +970,21 @@ export class TerminalTaskSystem implements ITaskSystem {
private collectTaskVariables(variables: Set<string>, task: CustomTask | ContributedTask): void {
if (task.command) {
this.collectCommandVariables(variables, task.command);
this.collectCommandVariables(variables, task.command, task);
}
this.collectMatcherVariables(variables, task.problemMatchers);
}
private collectCommandVariables(variables: Set<string>, command: CommandConfiguration): void {
private collectCommandVariables(variables: Set<string>, command: CommandConfiguration, task: CustomTask | ContributedTask): void {
this.collectVariables(variables, command.name);
if (command.args) {
command.args.forEach(arg => this.collectVariables(variables, arg));
}
variables.add('${workspaceFolder}');
// Try to get a scope.
const scope = (<ExtensionTaskSource>task._source).scope;
if (scope !== TaskScope.Global) {
variables.add('${workspaceFolder}');
}
if (command.options) {
let options = command.options;
if (options.cwd) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册