problemMatcher.ts ×24

Frontier kind: Code frontier

unlabeled · c_643ae95d7af1

7 tests · 12652 LOC · 50 files · introduces 0 tests · 100 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
25 ranges100 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1277 ranges12652 lines · 50 files · Browse complete extent
All tests (intent)
7 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 100 introduced LOC across 25 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/tasks/common/problemMatcher.ts 93 introduced LOC · 24 ranges

Open complete file

194
195
196 > export async function getResource(filename: string, matcher: ProblemMatcher, fileService?: IFileService): Promise<URI> { problemMatcher.ts
197 > const kind = matcher.fileLocation;
198 > let fullPath: string | undefined;
199 > if (kind === FileLocationKind.Absolute) {
200 > fullPath = filename;
201 > } else if ((kind === FileLocationKind.Relative) && matcher.filePrefix && Types.isString(matcher.filePrefix)) {
202 fullPath = join(matcher.filePrefix, filename);
203 } else if (kind === FileLocationKind.AutoDetect) {
232 }
233 }
234 > if (fullPath === undefined) { problemMatcher.ts
235 throw new Error('FileLocationKind is not actionable. Does the matcher have a filePrefix? This should never happen.');
236 }
237 > fullPath = normalize(fullPath); problemMatcher.ts
238 > fullPath = fullPath.replace(/\\/g, '/');
239 > if (fullPath[0] !== '/') {
240 fullPath = '/' + fullPath;
241 }
242 > if (matcher.uriProvider !== undefined) { problemMatcher.ts
243 return matcher.uriProvider(fullPath);
244 > } else { problemMatcher.ts
245 > return URI.file(fullPath);
246 > }
247 > }
248
249 async function searchForFileLocation(filename: string, fsProvider: IFileSystemProvider, args: Config.SearchFileLocationArgs): Promise<URI | undefined> {
346
347 protected fillProblemData(data: IProblemData | undefined, pattern: IProblemPattern, matches: RegExpExecArray): data is IProblemData {
348 > if (data) { problemMatcher.ts
349 > this.fillProperty(data, 'file', pattern, matches, true);
350 > this.appendProperty(data, 'message', pattern, matches, true);
351 > this.fillProperty(data, 'code', pattern, matches, true);
352 > this.fillProperty(data, 'severity', pattern, matches, true);
353 > this.fillProperty(data, 'location', pattern, matches, true);
354 > this.fillProperty(data, 'line', pattern, matches);
355 > this.fillProperty(data, 'character', pattern, matches);
356 > this.fillProperty(data, 'endLine', pattern, matches);
357 > this.fillProperty(data, 'endCharacter', pattern, matches);
358 > return true;
359 > } else {
360 return false;
361 }
363
364 private appendProperty(data: IProblemData, property: keyof IProblemData, pattern: IProblemPattern, matches: RegExpExecArray, trim: boolean = false): void {
365 > const patternProperty = pattern[property]; problemMatcher.ts
366 > if (Types.isUndefined(data[property])) {
367 > this.fillProperty(data, property, pattern, matches, trim);
368 > }
369 else if (!Types.isUndefined(patternProperty) && patternProperty < matches.length) {
370 let value = matches[patternProperty];
374 (data as Record<string, string | undefined>)[property] = data[property]! + endOfLine + value;
375 }
377
378 private fillProperty(data: IProblemData, property: keyof IProblemData, pattern: IProblemPattern, matches: RegExpExecArray, trim: boolean = false): void {
379 > const patternAtProperty = pattern[property]; problemMatcher.ts
380 > if (Types.isUndefined(data[property]) && !Types.isUndefined(patternAtProperty) && patternAtProperty < matches.length) {
381 > let value = matches[patternAtProperty];
382 > if (value !== undefined) {
383 > if (trim) {
384 > value = Strings.trim(value)!;
385 > }
386 > (data as Record<string, string | undefined>)[property] = value;
387 > }
388 > }
389 > }
390
391 protected getMarkerMatch(data: IProblemData): IProblemMatch | undefined {
392 > try { problemMatcher.ts
393 > const location = this.getLocation(data);
394 > if (data.file && location && data.message) {
395 > const marker: IMarkerData = {
396 > severity: this.getSeverity(data),
397 > startLineNumber: location.startLineNumber,
398 > startColumn: location.startCharacter,
399 > endLineNumber: location.endLineNumber,
400 > endColumn: location.endCharacter,
401 > message: data.message
402 > };
403 > if (data.code !== undefined) {
404 marker.code = data.code;
405 }
406 > if (this.matcher.source !== undefined) { problemMatcher.ts
407 marker.source = this.matcher.source;
408 }
409 > return { problemMatcher.ts
410 > description: this.matcher,
411 > resource: this.getResource(data.file),
412 > marker: marker
413 > };
414 > }
415 > } catch (err) {
416 console.error(`Failed to convert problem data into match: ${JSON.stringify(data)}`);
417 }
418 return undefined;
420
421 protected getResource(filename: string): Promise<URI> {
422 > return getResource(filename, this.matcher, this.fileService); problemMatcher.ts
423 > }
424
425 private getLocation(data: IProblemData): ILocation | null {
426 > if (data.kind === ProblemLocationKind.File) { problemMatcher.ts
427 return this.createLocation(0, 0, 0, 0);
428 }
434 }
435 const startLine = parseInt(data.line);
436 > const startColumn = data.character ? parseInt(data.character) : undefined; problemMatcher.ts
437 > const endLine = data.endLine ? parseInt(data.endLine) : undefined;
438 > const endColumn = data.endCharacter ? parseInt(data.endCharacter) : undefined;
439 > return this.createLocation(startLine, startColumn, endLine, endColumn);
440 > }
441
442 private parseLocationInfo(value: string): ILocation | null {
455
456 private createLocation(startLine: number, startColumn: number | undefined, endLine: number | undefined, endColumn: number | undefined): ILocation {
457 > if (startColumn !== undefined && endColumn !== undefined) { problemMatcher.ts
458 return { startLineNumber: startLine, startCharacter: startColumn, endLineNumber: endLine || startLine, endCharacter: endColumn };
459 }
462 }
463 return { startLineNumber: startLine, startCharacter: 1, endLineNumber: startLine, endCharacter: 2 ** 31 - 1 }; // See https://github.com/microsoft/vscode/issues/80288#issuecomment-650636442 for discussion
465
466 private getSeverity(data: IProblemData): MarkerSeverity {
467 > let result: Severity | null = null; problemMatcher.ts
468 > if (data.severity) {
469 > const value = data.severity;
470 > if (value) {
471 > result = Severity.fromValue(value);
472 > if (result === Severity.Ignore) {
473 if (value === 'E') {
474 result = Severity.Error;
483 }
484 }
486 > }
487 > if (result === null || result === Severity.Ignore) {
488 result = this.matcher.severity || Severity.Error;
489 }
490 > return MarkerSeverity.fromSeverity(result); problemMatcher.ts
491 > }
492 }
493
513 const matches = this.regexpExec(this.pattern.regexp, lines[start]);
514 if (matches) {
515 > this.fillProblemData(data, this.pattern, matches); problemMatcher.ts
516 > if (data.kind === ProblemLocationKind.Location && !data.location && !data.line && data.file) {
517 data.kind = ProblemLocationKind.File;
518 }
519 > const match = this.getMarkerMatch(data); problemMatcher.ts
520 > if (match) {
521 > return { match: match, continue: false };
522 > }
523 > }
524 return { match: null, continue: false };
525 }
src/vs/platform/markers/common/markers.ts 7 introduced LOC · 1 range

Open complete file

86
87 export function fromSeverity(severity: Severity): MarkerSeverity {
88 > switch (severity) { markers.ts
89 > case Severity.Error: return MarkerSeverity.Error;
90 > case Severity.Warning: return MarkerSeverity.Warning;
91 > case Severity.Info: return MarkerSeverity.Info;
92 > case Severity.Ignore: return MarkerSeverity.Hint;
93 > }
94 > }
95
96 export function toSeverity(severity: MarkerSeverity): Severity {