提交 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';
import { StartStopProblemCollector, WatchingProblemCollector, ProblemCollectorEventKind, ProblemHandlingStrategy } from 'vs/workbench/contrib/tasks/common/problemCollectors';
import {
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';
import {
ITaskSystem, ITaskSummary, ITaskExecuteResult, TaskExecuteKind, TaskError, TaskErrors, ITaskResolver,
......@@ -250,10 +250,12 @@ export class TerminalTaskSystem implements ITaskSystem {
executeResult.promise.then(summary => {
this.lastTask = this.currentTask;
});
if (!this.instances[commonKey]) {
this.instances[commonKey] = new InstanceManager();
if (InMemoryTask.is(task) || !this.isTaskEmpty(task)) {
if (!this.instances[commonKey]) {
this.instances[commonKey] = new InstanceManager();
}
this.instances[commonKey].addInstance();
}
this.instances[commonKey].addInstance();
return executeResult;
} catch (error) {
if (error instanceof TaskError) {
......@@ -606,8 +608,7 @@ export class TerminalTaskSystem implements ITaskSystem {
const resolvedVariables = this.resolveVariablesFromSet(systemInfo, workspaceFolder, task, variables, alreadyResolved);
return resolvedVariables.then((resolvedVariables) => {
const isCustomExecution = (task.command.runtime === RuntimeType.CustomExecution);
if (resolvedVariables && (task.command !== undefined) && task.command.runtime && (isCustomExecution || (task.command.name !== undefined))) {
if (resolvedVariables && !this.isTaskEmpty(task)) {
this.currentTask.resolvedVariables = resolvedVariables;
return this.executeInTerminal(task, trigger, new VariableResolver(workspaceFolder, systemInfo, resolvedVariables.variables, this.configurationResolverService), workspaceFolder);
} else {
......@@ -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> {
const lastTask = this.lastTask;
if (!lastTask) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册