Add a rerun last task command (#62645)

Fixes #25310
This commit is contained in:
Alex Ross
2018-11-20 09:40:54 +01:00
committed by GitHub
parent 47b3238330
commit 6bb77146c4
15 changed files with 345 additions and 104 deletions

View File

@@ -784,6 +784,7 @@ export function createApiFactory(
QuickInputButtons: extHostTypes.QuickInputButtons,
Range: extHostTypes.Range,
RelativePattern: extHostTypes.RelativePattern,
RerunBehavior: extHostTypes.RerunBehavior,
Selection: extHostTypes.Selection,
ShellExecution: extHostTypes.ShellExecution,
ShellQuoting: extHostTypes.ShellQuoting,
@@ -797,6 +798,7 @@ export function createApiFactory(
SymbolInformation: extHostTypes.SymbolInformation,
SymbolKind: extHostTypes.SymbolKind,
Task: extHostTypes.Task,
Task2: extHostTypes.Task,
TaskGroup: extHostTypes.TaskGroup,
TaskPanelKind: extHostTypes.TaskPanelKind,
TaskRevealKind: extHostTypes.TaskRevealKind,

View File

@@ -403,7 +403,8 @@ namespace Tasks {
command: command,
isBackground: !!task.isBackground,
problemMatchers: task.problemMatchers.slice(),
hasDefinedMatchers: (task as types.Task).hasDefinedMatchers
hasDefinedMatchers: (task as types.Task).hasDefinedMatchers,
runOptions: (<vscode.Task2>task).runOptions ? (<vscode.Task2>task).runOptions : { rerunBehavior: tasks.RerunBehavior.reevaluate },
};
return result;
}
@@ -629,7 +630,8 @@ namespace TaskDTO {
group: group,
presentationOptions: TaskPresentationOptionsDTO.from(value.presentationOptions),
problemMatchers: value.problemMatchers,
hasDefinedMatchers: (value as types.Task).hasDefinedMatchers
hasDefinedMatchers: (value as types.Task).hasDefinedMatchers,
runOptions: (<vscode.Task2>value).runOptions ? (<vscode.Task2>value).runOptions : { rerunBehavior: tasks.RerunBehavior.reevaluate },
};
return result;
}

View File

@@ -1591,7 +1591,12 @@ export enum TaskScope {
Workspace = 2
}
export class Task implements vscode.Task {
export enum RerunBehavior {
reevaluate = 1,
useEvaluated = 2,
}
export class Task implements vscode.Task2 {
private __id: string;
@@ -1605,6 +1610,7 @@ export class Task implements vscode.Task {
private _source: string;
private _group: TaskGroup;
private _presentationOptions: vscode.TaskPresentationOptions;
private _runOptions: vscode.RunOptions;
constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution, problemMatchers?: string | string[]);
constructor(definition: vscode.TaskDefinition, scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder, name: string, source: string, execution?: ProcessExecution | ShellExecution, problemMatchers?: string | string[]);
@@ -1782,6 +1788,18 @@ export class Task implements vscode.Task {
this.clear();
this._presentationOptions = value;
}
get runOptions(): vscode.RunOptions {
return this._runOptions;
}
set runOptions(value: vscode.RunOptions) {
if (value === null) {
value = undefined;
}
this.clear();
this._runOptions = value;
}
}