提交 46d8d3aa 编写于 作者: A Alex Ross

Tasks without command are added to instances

Part of #92792
上级 de976e87
...@@ -33,7 +33,7 @@ import { IOutputService } from 'vs/workbench/contrib/output/common/output'; ...@@ -33,7 +33,7 @@ import { IOutputService } from 'vs/workbench/contrib/output/common/output';
import { StartStopProblemCollector, WatchingProblemCollector, ProblemCollectorEventKind, ProblemHandlingStrategy } from 'vs/workbench/contrib/tasks/common/problemCollectors'; import { StartStopProblemCollector, WatchingProblemCollector, ProblemCollectorEventKind, ProblemHandlingStrategy } from 'vs/workbench/contrib/tasks/common/problemCollectors';
import { import {
Task, CustomTask, ContributedTask, RevealKind, CommandOptions, ShellConfiguration, RuntimeType, PanelKind, Task, CustomTask, ContributedTask, RevealKind, CommandOptions, ShellConfiguration, RuntimeType, PanelKind,
TaskEvent, TaskEventKind, ShellQuotingOptions, ShellQuoting, CommandString, CommandConfiguration, ExtensionTaskSource, TaskScope, RevealProblemKind, DependsOrder, TaskSourceKind TaskEvent, TaskEventKind, ShellQuotingOptions, ShellQuoting, CommandString, CommandConfiguration, ExtensionTaskSource, TaskScope, RevealProblemKind, DependsOrder, TaskSourceKind, InMemoryTask
} from 'vs/workbench/contrib/tasks/common/tasks'; } from 'vs/workbench/contrib/tasks/common/tasks';
import { import {
ITaskSystem, ITaskSummary, ITaskExecuteResult, TaskExecuteKind, TaskError, TaskErrors, ITaskResolver, ITaskSystem, ITaskSummary, ITaskExecuteResult, TaskExecuteKind, TaskError, TaskErrors, ITaskResolver,
...@@ -250,10 +250,12 @@ export class TerminalTaskSystem implements ITaskSystem { ...@@ -250,10 +250,12 @@ export class TerminalTaskSystem implements ITaskSystem {
executeResult.promise.then(summary => { executeResult.promise.then(summary => {
this.lastTask = this.currentTask; this.lastTask = this.currentTask;
}); });
if (!this.instances[commonKey]) { if (InMemoryTask.is(task) || !this.isTaskEmpty(task)) {
this.instances[commonKey] = new InstanceManager(); if (!this.instances[commonKey]) {
this.instances[commonKey] = new InstanceManager();
}
this.instances[commonKey].addInstance();
} }
this.instances[commonKey].addInstance();
return executeResult; return executeResult;
} catch (error) { } catch (error) {
if (error instanceof TaskError) { if (error instanceof TaskError) {
...@@ -606,8 +608,7 @@ export class TerminalTaskSystem implements ITaskSystem { ...@@ -606,8 +608,7 @@ export class TerminalTaskSystem implements ITaskSystem {
const resolvedVariables = this.resolveVariablesFromSet(systemInfo, workspaceFolder, task, variables, alreadyResolved); const resolvedVariables = this.resolveVariablesFromSet(systemInfo, workspaceFolder, task, variables, alreadyResolved);
return resolvedVariables.then((resolvedVariables) => { return resolvedVariables.then((resolvedVariables) => {
const isCustomExecution = (task.command.runtime === RuntimeType.CustomExecution); if (resolvedVariables && !this.isTaskEmpty(task)) {
if (resolvedVariables && (task.command !== undefined) && task.command.runtime && (isCustomExecution || (task.command.name !== undefined))) {
this.currentTask.resolvedVariables = resolvedVariables; this.currentTask.resolvedVariables = resolvedVariables;
return this.executeInTerminal(task, trigger, new VariableResolver(workspaceFolder, systemInfo, resolvedVariables.variables, this.configurationResolverService), workspaceFolder); return this.executeInTerminal(task, trigger, new VariableResolver(workspaceFolder, systemInfo, resolvedVariables.variables, this.configurationResolverService), workspaceFolder);
} else { } else {
...@@ -620,6 +621,11 @@ export class TerminalTaskSystem implements ITaskSystem { ...@@ -620,6 +621,11 @@ export class TerminalTaskSystem implements ITaskSystem {
}); });
} }
private isTaskEmpty(task: CustomTask | ContributedTask): boolean {
const isCustomExecution = (task.command.runtime === RuntimeType.CustomExecution);
return !((task.command !== undefined) && task.command.runtime && (isCustomExecution || (task.command.name !== undefined)));
}
private reexecuteCommand(task: CustomTask | ContributedTask, trigger: string, alreadyResolved: Map<string, string>): Promise<ITaskSummary> { private reexecuteCommand(task: CustomTask | ContributedTask, trigger: string, alreadyResolved: Map<string, string>): Promise<ITaskSummary> {
const lastTask = this.lastTask; const lastTask = this.lastTask;
if (!lastTask) { if (!lastTask) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册