提交 1f172f36 编写于 作者: A Alex Ross

Update allow automatic task notification with feedback

Fixes #64427
上级 22493520
......@@ -78,7 +78,7 @@ export interface ITaskService {
needsFolderQualification();
canCustomize(task: ContributedTask | CustomTask): boolean;
customize(task: ContributedTask | CustomTask, properties?: {}, openConfig?: boolean): TPromise<void>;
openConfig(task: CustomTask): TPromise<void>;
openConfig(task: CustomTask | undefined): TPromise<void>;
registerTaskProvider(taskProvider: ITaskProvider): IDisposable;
......
......@@ -20,7 +20,6 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut
@IStorageService private readonly storageService: IStorageService,
@INotificationService private readonly notificationService: INotificationService) {
super();
const isFolderAutomaticAllowed = storageService.getBoolean(ARE_AUTOMATIC_TASKS_ALLOWED_IN_WORKSPACE, StorageScope.WORKSPACE, undefined);
this.tryRunTasks(isFolderAutomaticAllowed);
}
......@@ -83,7 +82,7 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut
private showPrompt(): Promise<boolean> {
return new Promise<boolean>(resolve => {
this.notificationService.prompt(Severity.Info, nls.localize('tasks.run.allowAutomatic', "This folder has automatic tasks defined in tasks.json. Do you allow automatic tasks to run when you open this folder/workspace?"),
this.notificationService.prompt(Severity.Info, nls.localize('tasks.run.allowAutomatic', "This folder has tasks defined in \'tasks.json\' that run automatically when you open this folder. Do you allow automatic tasks to run when you open this folder?"),
[{
label: nls.localize('allow', "Allow"),
run: () => {
......@@ -99,8 +98,9 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut
}
},
{
label: nls.localize('notThisTime', "Not this time"),
label: nls.localize('openTasks', "Open tasks.json"),
run: () => {
this.taskService.openConfig(undefined);
resolve(false);
}
}]
......
......@@ -1096,8 +1096,13 @@ class TaskService extends Disposable implements ITaskService {
}
}
public openConfig(task: CustomTask): TPromise<void> {
let resource = Task.getWorkspaceFolder(task).toResource(task._source.config.file);
public openConfig(task: CustomTask | undefined): TPromise<void> {
let resource: URI;
if (task) {
resource = Task.getWorkspaceFolder(task).toResource(task._source.config.file);
} else {
resource = (this._workspaceFolders && (this._workspaceFolders.length > 0)) ? this._workspaceFolders[0].toResource('.vscode/tasks.json') : undefined;
}
return this.editorService.openEditor({
resource,
options: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册