Fixes #3221: Task runner problemMatcher could use an origin or source field

This commit is contained in:
Dirk Baeumer 2018-03-06 21:12:31 +01:00
parent 8d812a315a
commit a5ecf9d363
3 changed files with 42 additions and 11 deletions

View file

@ -26,6 +26,7 @@
"name": "lessc",
"label": "Lessc compiler",
"owner": "lessc",
"source": "less",
"fileLocation": "absolute",
"pattern": {
"regexp": "(.*)\\sin\\s(.*)\\son line\\s(\\d+),\\scolumn\\s(\\d+)",

View file

@ -552,6 +552,7 @@
"name": "tsc",
"label": "%typescript.problemMatchers.tsc.label%",
"owner": "typescript",
"source": "ts",
"applyTo": "closedDocuments",
"fileLocation": [
"relative",
@ -563,6 +564,7 @@
"name": "tsc-watch",
"label": "%typescript.problemMatchers.tscWatch.label%",
"owner": "typescript",
"source": "ts",
"applyTo": "closedDocuments",
"fileLocation": [
"relative",

View file

@ -127,6 +127,7 @@ export module ApplyToKind {
export interface ProblemMatcher {
owner: string;
source?: string;
applyTo: ApplyToKind;
fileLocation: FileLocationKind;
filePrefix?: string;
@ -278,9 +279,12 @@ abstract class AbstractLineMatcher implements ILineMatcher {
endColumn: location.endCharacter,
message: data.message
};
if (!Types.isUndefined(data.code)) {
if (data.code !== void 0) {
marker.code = data.code;
}
if (this.matcher.source !== void 0) {
marker.source = this.matcher.source;
}
return {
description: this.matcher,
resource: this.getResource(data.file),
@ -638,21 +642,27 @@ export namespace Config {
export interface ProblemMatcher {
/**
* The name of a base problem matcher to use. If specified the
* base problem matcher will be used as a template and properties
* specified here will replace properties of the base problem
* matcher
*/
* The name of a base problem matcher to use. If specified the
* base problem matcher will be used as a template and properties
* specified here will replace properties of the base problem
* matcher
*/
base?: string;
/**
* The owner of the produced VSCode problem. This is typically
* the identifier of a VSCode language service if the problems are
* to be merged with the one produced by the language service
* or a generated internal id. Defaults to the generated internal id.
*/
* The owner of the produced VSCode problem. This is typically
* the identifier of a VSCode language service if the problems are
* to be merged with the one produced by the language service
* or a generated internal id. Defaults to the generated internal id.
*/
owner?: string;
/**
* A human-readable string describing the source of this problem.
* E.g. 'typescript' or 'super lint'.
*/
source?: string;
/**
* Specifies to which kind of documents the problems found by this
* matcher are applied. Valid values are:
@ -1240,6 +1250,7 @@ export class ProblemMatcherParser extends Parser {
let result: ProblemMatcher = null;
let owner = description.owner ? description.owner : UUID.generateUuid();
let source = Types.isString(description.source) ? description.source : undefined;
let applyTo = Types.isString(description.applyTo) ? ApplyToKind.fromString(description.applyTo) : ApplyToKind.allDocuments;
if (!applyTo) {
applyTo = ApplyToKind.allDocuments;
@ -1289,6 +1300,9 @@ export class ProblemMatcherParser extends Parser {
if (description.owner) {
result.owner = owner;
}
if (source) {
result.source = source;
}
if (fileLocation) {
result.fileLocation = fileLocation;
}
@ -1310,6 +1324,9 @@ export class ProblemMatcherParser extends Parser {
fileLocation: fileLocation,
pattern: pattern,
};
if (source) {
result.source = source;
}
if (filePrefix) {
result.filePrefix = filePrefix;
}
@ -1457,6 +1474,10 @@ export namespace Schemas {
type: 'string',
description: localize('ProblemMatcherSchema.owner', 'The owner of the problem inside Code. Can be omitted if base is specified. Defaults to \'external\' if omitted and base is not specified.')
},
source: {
type: 'string',
description: localize('ProblemMatcherSchema.source', 'A human-readable string describing the source of this diagnostic, e.g. \'typescript\' or \'super lint\'.')
},
severity: {
type: 'string',
enum: ['error', 'warning', 'info'],
@ -1646,6 +1667,7 @@ class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
label: localize('lessCompile', 'Less problems'),
deprecated: true,
owner: 'lessCompile',
source: 'less',
applyTo: ApplyToKind.allDocuments,
fileLocation: FileLocationKind.Absolute,
pattern: ProblemPatternRegistry.get('lessCompile'),
@ -1656,6 +1678,7 @@ class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
name: 'gulp-tsc',
label: localize('gulp-tsc', 'Gulp TSC Problems'),
owner: 'typescript',
source: 'ts',
applyTo: ApplyToKind.closedDocuments,
fileLocation: FileLocationKind.Relative,
filePrefix: '${workspaceFolder}',
@ -1666,6 +1689,7 @@ class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
name: 'jshint',
label: localize('jshint', 'JSHint problems'),
owner: 'jshint',
source: 'jshint',
applyTo: ApplyToKind.allDocuments,
fileLocation: FileLocationKind.Absolute,
pattern: ProblemPatternRegistry.get('jshint')
@ -1675,6 +1699,7 @@ class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
name: 'jshint-stylish',
label: localize('jshint-stylish', 'JSHint stylish problems'),
owner: 'jshint',
source: 'jshint',
applyTo: ApplyToKind.allDocuments,
fileLocation: FileLocationKind.Absolute,
pattern: ProblemPatternRegistry.get('jshint-stylish')
@ -1684,6 +1709,7 @@ class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
name: 'eslint-compact',
label: localize('eslint-compact', 'ESLint compact problems'),
owner: 'eslint',
source: 'eslint',
applyTo: ApplyToKind.allDocuments,
fileLocation: FileLocationKind.Absolute,
filePrefix: '${workspaceFolder}',
@ -1694,6 +1720,7 @@ class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
name: 'eslint-stylish',
label: localize('eslint-stylish', 'ESLint stylish problems'),
owner: 'eslint',
source: 'eslint',
applyTo: ApplyToKind.allDocuments,
fileLocation: FileLocationKind.Absolute,
pattern: ProblemPatternRegistry.get('eslint-stylish')
@ -1703,6 +1730,7 @@ class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
name: 'go',
label: localize('go', 'Go problems'),
owner: 'go',
source: 'go',
applyTo: ApplyToKind.allDocuments,
fileLocation: FileLocationKind.Relative,
filePrefix: '${workspaceFolder}',