提交 a48e0685 编写于 作者: D Dirk Baeumer

Fixes #29610: Improve presentation of problem matcher picker

上级 471ef70b
......@@ -29,7 +29,9 @@ class TaskEntry extends base.TaskEntry {
let task = this._task;
if (this.taskService.canCustomize() && task.problemMatchers === void 0 || task.problemMatchers.length === 0) {
this.attachProblemMatcher(task).then((task) => {
this.doRun(task);
if (task) {
this.doRun(task);
}
});
return true;
} else {
......
......@@ -23,6 +23,7 @@ import { ActionBarContributor, ContributableActionProvider } from 'vs/workbench/
interface ProblemMatcherPickEntry extends IPickOpenEntry {
matcher: NamedProblemMatcher;
learnMore?: boolean;
}
export class TaskEntry extends Model.QuickOpenEntry {
......@@ -50,20 +51,36 @@ export class TaskEntry extends Model.QuickOpenEntry {
if (matcher.name === matcher.label) {
entries.push({ label: matcher.name, matcher: matcher });
} else {
entries.push({ label: nls.localize('entries', '{0} [${1}]', matcher.label, matcher.name), matcher: matcher });
entries.push({
label: matcher.label,
description: `$${matcher.name}`,
matcher: matcher
});
}
}
if (entries.length > 0) {
entries.push({ label: 'Continue without scanning the build output', separator: { border: true }, matcher: undefined });
entries = entries.sort((a, b) => a.label.localeCompare(b.label));
entries[0].separator = { border: true };
entries.unshift(
{ label: nls.localize('continueWithout', 'Continue without scanning the build output'), matcher: undefined },
{ label: nls.localize('learnMoreAbout', 'Learn more about scanning the build output'), matcher: undefined, learnMore: true }
);
return this.quickOpenService.pick(entries, {
placeHolder: nls.localize('selectProblemMatcher', 'Select for which kind of errors and warnings to scan the build output')
}).then((selected) => {
if (selected && selected.matcher) {
let newTask = Objects.deepClone(task);
let matcherReference = `$${selected.matcher.name}`;
newTask.problemMatchers = [matcherReference];
this.taskService.customize(task, { problemMatcher: [matcherReference] }, true);
return newTask;
if (selected) {
if (selected.learnMore) {
this.taskService.openDocumentation();
return undefined;
} else if (selected.matcher) {
let newTask = Objects.deepClone(task);
let matcherReference = `$${selected.matcher.name}`;
newTask.problemMatchers = [matcherReference];
this.taskService.customize(task, { problemMatcher: [matcherReference] }, true);
return newTask;
} else {
return task;
}
} else {
return task;
}
......
......@@ -28,7 +28,11 @@ class TaskEntry extends base.TaskEntry {
}
let task = this._task;
if (this.taskService.canCustomize() && task.group === TaskGroup.Build && ((task.problemMatchers === void 0) || task.problemMatchers.length === 0)) {
this.attachProblemMatcher(task).then(task => this.doRun(task));
this.attachProblemMatcher(task).then(task => {
if (task) {
this.doRun(task);
}
});
return true;
} else {
return this.doRun(task);
......
......@@ -30,6 +30,7 @@ export interface ITaskProvider {
export interface ITaskService extends IEventEmitter {
_serviceBrand: any;
configureAction(): Action;
openDocumentation(): void;
build(): TPromise<ITaskSummary>;
rebuild(): TPromise<ITaskSummary>;
clean(): TPromise<ITaskSummary>;
......
......@@ -14,6 +14,7 @@ import * as nls from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import Severity from 'vs/base/common/severity';
import * as Objects from 'vs/base/common/objects';
import URI from 'vs/base/common/uri';
import { IStringDictionary } from 'vs/base/common/collections';
import { Action } from 'vs/base/common/actions';
import * as Dom from 'vs/base/browser/dom';
......@@ -45,6 +46,7 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
import { ProblemMatcherRegistry } from 'vs/platform/markers/common/problemMatcher';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IProgressService2, IProgressOptions, ProgressLocation } from 'vs/platform/progress/common/progress';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IModelService } from 'vs/editor/common/services/modelService';
......@@ -573,7 +575,8 @@ class TaskService extends EventEmitter implements ITaskService {
@ITerminalService private terminalService: ITerminalService,
@IWorkbenchEditorService private workbenchEditorService: IWorkbenchEditorService,
@IStorageService private storageService: IStorageService,
@IProgressService2 private progressService: IProgressService2
@IProgressService2 private progressService: IProgressService2,
@IOpenerService private openerService: IOpenerService
) {
super();
......@@ -742,6 +745,10 @@ class TaskService extends EventEmitter implements ITaskService {
this.storageService.store(TaskService.RecentlyUsedTasks_Key, JSON.stringify(values), StorageScope.WORKSPACE);
}
public openDocumentation(): void {
this.openerService.open(URI.parse('https://go.microsoft.com/fwlink/?LinkId=733558'));
}
public build(): TPromise<ITaskSummary> {
return this.getTaskSets().then((values) => {
let runnable = this.createRunnableTask(values, TaskGroup.Build);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册