Merge from vscode 731f9c25632dbbf01ee3a7892ad9d2791fe0260c

This commit is contained in:
ADS Merger
2020-07-24 05:27:34 +00:00
parent eccf3cf5fe
commit d965d4aef3
145 changed files with 3072 additions and 1550 deletions

View File

@@ -80,6 +80,7 @@ import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cance
import { IViewsService, IViewDescriptorService } from 'vs/workbench/common/views';
import { isWorkspaceFolder, TaskQuickPickEntry, QUICKOPEN_DETAIL_CONFIG, TaskQuickPick, QUICKOPEN_SKIP_CONFIG } from 'vs/workbench/contrib/tasks/browser/taskQuickPick';
import { ILogService } from 'vs/platform/log/common/log';
import { once } from 'vs/base/common/functional';
const QUICKOPEN_HISTORY_LIMIT_CONFIG = 'task.quickOpen.history';
const PROBLEM_MATCHER_NEVER_CONFIG = 'task.problemMatchers.neverPrompt';
@@ -223,6 +224,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
protected _outputChannel: IOutputChannel;
protected readonly _onDidStateChange: Emitter<TaskEvent>;
private _waitForSupportedExecutions: Promise<void>;
private _onDidRegisterSupportedExecutions: Emitter<void> = new Emitter();
constructor(
@IConfigurationService private readonly configurationService: IConfigurationService,
@@ -331,16 +334,26 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
}
return task._label;
});
this.setExecutionContexts();
this._waitForSupportedExecutions = new Promise(resolve => {
once(this._onDidRegisterSupportedExecutions.event)(() => resolve());
});
}
protected setExecutionContexts(custom: boolean = true, shell: boolean = true, process: boolean = true): void {
const customContext = CustomExecutionSupportedContext.bindTo(this.contextKeyService);
customContext.set(custom);
const shellContext = ShellExecutionSupportedContext.bindTo(this.contextKeyService);
shellContext.set(shell);
const processContext = ProcessExecutionSupportedContext.bindTo(this.contextKeyService);
processContext.set(process);
public registerSupportedExecutions(custom?: boolean, shell?: boolean, process?: boolean) {
if (custom !== undefined) {
const customContext = CustomExecutionSupportedContext.bindTo(this.contextKeyService);
customContext.set(custom);
}
if (shell !== undefined) {
const shellContext = ShellExecutionSupportedContext.bindTo(this.contextKeyService);
shellContext.set(shell);
}
if (process !== undefined) {
const processContext = ProcessExecutionSupportedContext.bindTo(this.contextKeyService);
processContext.set(process);
}
this._onDidRegisterSupportedExecutions.fire();
}
public get onDidStateChange(): Event<TaskEvent> {
@@ -530,9 +543,6 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
}
public registerTaskSystem(key: string, info: TaskSystemInfo): void {
if (info.platform === Platform.Platform.Web) {
this.setExecutionContexts(true, false, false);
}
this._taskSystemInfos.set(key, info);
}
@@ -834,7 +844,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
this.openerService.open(URI.parse('https://go.microsoft.com/fwlink/?LinkId=733558'));
}
public build(): Promise<ITaskSummary> {
public async build(): Promise<ITaskSummary> {
return this.getGroupedTasks().then((tasks) => {
let runnable = this.createRunnableTask(tasks, TaskGroup.Build);
if (!runnable || !runnable.task) {
@@ -844,7 +854,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
throw new TaskError(Severity.Info, nls.localize('TaskService.noBuildTask2', 'No build task defined. Mark a task with as a \'build\' group in the tasks.json file.'), TaskErrors.NoBuildTask);
}
}
return this.executeTask(runnable.task, runnable.resolver);
return this.executeTask(runnable.task, runnable.resolver, TaskRunSource.User);
}).then(value => value, (error) => {
this.handleError(error);
return Promise.reject(error);
@@ -861,7 +871,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
throw new TaskError(Severity.Info, nls.localize('TaskService.noTestTask2', 'No test task defined. Mark a task with as a \'test\' group in the tasks.json file.'), TaskErrors.NoTestTask);
}
}
return this.executeTask(runnable.task, runnable.resolver);
return this.executeTask(runnable.task, runnable.resolver, TaskRunSource.User);
}).then(value => value, (error) => {
this.handleError(error);
return Promise.reject(error);
@@ -878,7 +888,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
if (options && options.attachProblemMatcher && this.shouldAttachProblemMatcher(task) && !InMemoryTask.is(task)) {
const toExecute = await this.attachProblemMatcher(task);
if (toExecute) {
resolve(this.executeTask(toExecute, resolver));
resolve(this.executeTask(toExecute, resolver, runSource));
} else {
resolve(undefined);
}
@@ -1452,7 +1462,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
};
}
private executeTask(task: Task, resolver: ITaskResolver, runSource?: TaskRunSource): Promise<ITaskSummary> {
private executeTask(task: Task, resolver: ITaskResolver, runSource: TaskRunSource): Promise<ITaskSummary> {
enum SaveBeforeRunConfigOptions {
Always = 'always',
Never = 'never',
@@ -1831,7 +1841,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
return result;
}
public getWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise<Map<string, WorkspaceFolderTaskResult>> {
public async getWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise<Map<string, WorkspaceFolderTaskResult>> {
await this._waitForSupportedExecutions;
if (this._workspaceTasksPromise) {
return this._workspaceTasksPromise;
}