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

Update allow automatic task notification with feedback

Fixes #64427
上级 22493520
...@@ -78,7 +78,7 @@ export interface ITaskService { ...@@ -78,7 +78,7 @@ export interface ITaskService {
needsFolderQualification(); needsFolderQualification();
canCustomize(task: ContributedTask | CustomTask): boolean; canCustomize(task: ContributedTask | CustomTask): boolean;
customize(task: ContributedTask | CustomTask, properties?: {}, openConfig?: boolean): TPromise<void>; customize(task: ContributedTask | CustomTask, properties?: {}, openConfig?: boolean): TPromise<void>;
openConfig(task: CustomTask): TPromise<void>; openConfig(task: CustomTask | undefined): TPromise<void>;
registerTaskProvider(taskProvider: ITaskProvider): IDisposable; registerTaskProvider(taskProvider: ITaskProvider): IDisposable;
......
...@@ -20,7 +20,6 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut ...@@ -20,7 +20,6 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut
@IStorageService private readonly storageService: IStorageService, @IStorageService private readonly storageService: IStorageService,
@INotificationService private readonly notificationService: INotificationService) { @INotificationService private readonly notificationService: INotificationService) {
super(); super();
const isFolderAutomaticAllowed = storageService.getBoolean(ARE_AUTOMATIC_TASKS_ALLOWED_IN_WORKSPACE, StorageScope.WORKSPACE, undefined); const isFolderAutomaticAllowed = storageService.getBoolean(ARE_AUTOMATIC_TASKS_ALLOWED_IN_WORKSPACE, StorageScope.WORKSPACE, undefined);
this.tryRunTasks(isFolderAutomaticAllowed); this.tryRunTasks(isFolderAutomaticAllowed);
} }
...@@ -83,7 +82,7 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut ...@@ -83,7 +82,7 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut
private showPrompt(): Promise<boolean> { private showPrompt(): Promise<boolean> {
return new Promise<boolean>(resolve => { 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"), label: nls.localize('allow', "Allow"),
run: () => { run: () => {
...@@ -99,8 +98,9 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut ...@@ -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: () => { run: () => {
this.taskService.openConfig(undefined);
resolve(false); resolve(false);
} }
}] }]
......
...@@ -1096,8 +1096,13 @@ class TaskService extends Disposable implements ITaskService { ...@@ -1096,8 +1096,13 @@ class TaskService extends Disposable implements ITaskService {
} }
} }
public openConfig(task: CustomTask): TPromise<void> { public openConfig(task: CustomTask | undefined): TPromise<void> {
let resource = Task.getWorkspaceFolder(task).toResource(task._source.config.file); 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({ return this.editorService.openEditor({
resource, resource,
options: { options: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册