Fixes #27726: Tasks.json: Provide intellisense for problem matcher

This commit is contained in:
Dirk Baeumer 2017-06-01 09:39:39 +02:00
parent eac49a321b
commit b648f36f70
3 changed files with 34 additions and 0 deletions

View file

@ -1482,6 +1482,8 @@ export interface IProblemMatcherRegistry {
onReady(): TPromise<void>;
exists(name: string): boolean;
get(name: string): ProblemMatcher;
values(): ProblemMatcher[];
keys(): string[];
}
class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
@ -1536,6 +1538,14 @@ class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
delete this.matchers[name];
}
public keys(): string[] {
return Object.keys(this.matchers);
}
public values(): ProblemMatcher[] {
return Object.keys(this.matchers).map(key => this.matchers[key]);
}
private fillDefaults(): void {
this.add('msCompile', {
owner: 'msCompile',

View file

@ -8,6 +8,8 @@ import * as nls from 'vs/nls';
import * as Objects from 'vs/base/common/objects';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { ProblemMatcherRegistry } from 'vs/platform/markers/common/problemMatcher';
import commonSchema from './jsonSchemaCommon';
const schema: IJSONSchema = {
@ -89,4 +91,14 @@ function fixReferences(literal: any) {
}
fixReferences(schema);
ProblemMatcherRegistry.onReady().then(() => {
try {
let matcherIds = ProblemMatcherRegistry.keys().map(key => '$' + key);
definitions.problemMatcherType1.oneOf[0].enum = matcherIds;
(definitions.problemMatcherType1.oneOf[2].items as IJSONSchema).anyOf[1].enum = matcherIds;
} catch (err) {
console.log('Installing problem matcher ids failed');
}
});
export default schema;

View file

@ -10,6 +10,8 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
import commonSchema from './jsonSchemaCommon';
import { ProblemMatcherRegistry } from 'vs/platform/markers/common/problemMatcher';
const shellCommand: IJSONSchema = {
anyOf: [
{
@ -162,4 +164,14 @@ function fixReferences(literal: any) {
}
fixReferences(schema);
ProblemMatcherRegistry.onReady().then(() => {
try {
let matcherIds = ProblemMatcherRegistry.keys().map(key => '$' + key);
definitions.problemMatcherType2.oneOf[0].enum = matcherIds;
(definitions.problemMatcherType2.oneOf[2].items as IJSONSchema).anyOf[1].enum = matcherIds;
} catch (err) {
console.log('Installing problem matcher ids failed');
}
});
export default schema;