problemMatcher.ts ×30

Frontier kind: Code frontier

unlabeled · c_6e7cc962f653

6 tests · 21551 LOC · 80 files · introduces 0 tests · 84 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
35 ranges84 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2621 ranges21551 lines · 80 files · Browse complete extent
All tests (intent)
6 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.

3 files ranked by introduced lines: 84 introduced LOC across 35 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/tasks/common/problemMatcher.ts 73 introduced LOC · 30 ranges

Open complete file

935
936 export function isNamedProblemMatcher(value: ProblemMatcher): value is INamedProblemMatcher {
937 > return Types.isString((<INamedProblemMatcher>value).name); problemMatcher.ts
938 > }
939 }
940
1633
1634 constructor(logger: IProblemReporter) {
1635 > super(logger); problemMatcher.ts
1636 > }
1637
1638 public parse(json: Config.ProblemMatcher): ProblemMatcher | undefined {
1639 > const result = this.createProblemMatcher(json); problemMatcher.ts
1640 > if (!this.checkProblemMatcherValid(json, result)) {
1641 return undefined;
1642 }
1643 > this.addWatchingMatcher(json, result); problemMatcher.ts
1644 >
1645 > return result;
1646 > }
1647
1648 private checkProblemMatcherValid(externalProblemMatcher: Config.ProblemMatcher, problemMatcher: ProblemMatcher | null): problemMatcher is ProblemMatcher {
1649 > if (!problemMatcher) { problemMatcher.ts
1650 this.error(localize('ProblemMatcherParser.noProblemMatcher', 'Error: the description can\'t be converted into a problem matcher:\n{0}\n', JSON.stringify(externalProblemMatcher, null, 4)));
1651 return false;
1652 }
1653 > if (!problemMatcher.pattern) { problemMatcher.ts
1654 this.error(localize('ProblemMatcherParser.noProblemPattern', 'Error: the description doesn\'t define a valid problem pattern:\n{0}\n', JSON.stringify(externalProblemMatcher, null, 4)));
1655 return false;
1656 }
1657 > if (!problemMatcher.owner) { problemMatcher.ts
1658 this.error(localize('ProblemMatcherParser.noOwner', 'Error: the description doesn\'t define an owner:\n{0}\n', JSON.stringify(externalProblemMatcher, null, 4)));
1659 return false;
1660 }
1661 > if (Types.isUndefined(problemMatcher.fileLocation)) { problemMatcher.ts
1662 this.error(localize('ProblemMatcherParser.noFileLocation', 'Error: the description doesn\'t define a file location:\n{0}\n', JSON.stringify(externalProblemMatcher, null, 4)));
1663 return false;
1664 }
1665 > return true; problemMatcher.ts
1666 > }
1667
1668 private createProblemMatcher(description: Config.ProblemMatcher): ProblemMatcher | null {
1669 > let result: ProblemMatcher | null = null; problemMatcher.ts
1670 >
1671 > const owner = Types.isString(description.owner) ? description.owner : UUID.generateUuid();
1672 > const source = Types.isString(description.source) ? description.source : undefined;
1673 > let applyTo = Types.isString(description.applyTo) ? ApplyToKind.fromString(description.applyTo) : ApplyToKind.allDocuments;
1674 > if (!applyTo) {
1675 applyTo = ApplyToKind.allDocuments;
1676 }
1677 > let fileLocation: FileLocationKind | undefined = undefined; problemMatcher.ts
1678 > let filePrefix: string | Config.SearchFileLocationArgs | undefined = undefined;
1679 >
1680 > let kind: FileLocationKind | undefined;
1681 > if (Types.isUndefined(description.fileLocation)) {
1682 fileLocation = FileLocationKind.Relative;
1683 filePrefix = '${workspaceFolder}';
1684 > } else if (Types.isString(description.fileLocation)) { problemMatcher.ts
1685 kind = FileLocationKind.fromString(<string>description.fileLocation);
1686 if (kind) {
1710 }
1711 }
1713 > const pattern = description.pattern ? this.createProblemPattern(description.pattern) : undefined;
1714 >
1715 > let severity = description.severity ? Severity.fromValue(description.severity) : undefined;
1716 > if (severity === Severity.Ignore) {
1717 this.info(localize('ProblemMatcherParser.unknownSeverity', 'Info: unknown severity {0}. Valid values are error, warning and info.\n', description.severity));
1718 severity = Severity.Error;
1719 }
1721 > if (Types.isString(description.base)) {
1722 const variableName = <string>description.base;
1723 if (variableName.length > 1 && variableName[0] === '$') {
1746 }
1747 }
1748 > } else if (fileLocation && pattern) { problemMatcher.ts
1749 > result = {
1750 > owner: owner,
1751 > applyTo: applyTo,
1752 > fileLocation: fileLocation,
1753 > pattern: pattern,
1754 > };
1755 > if (source) {
1756 result.source = source;
1757 }
1758 > if (filePrefix) { problemMatcher.ts
1759 result.filePrefix = filePrefix;
1760 }
1761 > if (severity) { problemMatcher.ts
1762 result.severity = severity;
1763 }
1765 > if (Config.isNamedProblemMatcher(description)) {
1766 (result as INamedProblemMatcher).name = description.name;
1767 (result as INamedProblemMatcher).label = Types.isString(description.label) ? description.label : description.name;
1768 }
1769 > return result; problemMatcher.ts
1770 > }
1771
1772 private createProblemPattern(value: string | Config.IProblemPattern | Config.MultiLineProblemPattern): Types.SingleOrMany<IProblemPattern> | null {
1773 > if (Types.isString(value)) { problemMatcher.ts
1774 const variableName: string = <string>value;
1775 if (variableName.length > 1 && variableName[0] === '$') {
1786 }
1787 }
1788 > } else if (value) { problemMatcher.ts
1789 > const problemPatternParser = new ProblemPatternParser(this.problemReporter);
1790 > if (Array.isArray(value)) {
1791 return problemPatternParser.parse(value);
1792 > } else { problemMatcher.ts
1793 > return problemPatternParser.parse(value);
1794 > }
1795 > }
1796 return null;
1798
1799 private addWatchingMatcher(external: Config.ProblemMatcher, internal: ProblemMatcher): void {
1800 > const oldBegins = this.createRegularExpression(external.watchedTaskBeginsRegExp); problemMatcher.ts
1801 > const oldEnds = this.createRegularExpression(external.watchedTaskEndsRegExp);
1802 > if (oldBegins && oldEnds) {
1803 internal.watching = {
1804 activeOnStart: false,
1808 return;
1809 }
1810 > const backgroundMonitor = external.background || external.watching; problemMatcher.ts
1811 > if (Types.isUndefinedOrNull(backgroundMonitor)) {
1812 > return;
1813 > }
1814 const begins: IWatchingPattern | null = this.createWatchingPattern(backgroundMonitor.beginsPattern);
1815 const ends: IWatchingPattern | null = this.createWatchingPattern(backgroundMonitor.endsPattern);
1816 > if (begins && ends) { problemMatcher.ts
1817 internal.watching = {
1818 activeOnStart: Types.isBoolean(backgroundMonitor.activeOnStart) ? backgroundMonitor.activeOnStart : false,
1822 return;
1823 }
1824 > if (begins || ends) { problemMatcher.ts
1825 this.error(localize('ProblemMatcherParser.problemPattern.watchingMatcher', 'A problem matcher must define both a begin pattern and an end pattern for watching.'));
1826 }
1828
1829 private createWatchingPattern(external: string | Config.IWatchingPattern | undefined): IWatchingPattern | null {
1848
1849 private createRegularExpression(value: string | undefined): RegExp | null {
1850 > let result: RegExp | null = null; problemMatcher.ts
1851 > if (!value) {
1852 > return result;
1853 > }
1854 try {
1855 result = new RegExp(value);
src/vs/workbench/contrib/tasks/common/taskConfiguration.ts 9 introduced LOC · 4 ranges

Open complete file

1220 result = from(osExternal.linux.problemMatcher, context);
1221 } else if (external.problemMatcher) {
1222 > result = from(external.problemMatcher, context); taskConfiguration.ts
1223 > }
1224 return result;
1225 }
1263 return ProblemMatcherKind.Array;
1264 } else if (!Types.isUndefined(value)) {
1265 > return ProblemMatcherKind.ProblemMatcher; taskConfiguration.ts
1266 > } else {
1267 return ProblemMatcherKind.Unknown;
1268 }
1288 return { errors: [nls.localize('ConfigurationParser.invalidVariableReference', 'Error: Invalid problemMatcher reference: {0}\n', value)] };
1289 } else {
1290 > const json = <ProblemMatcherConfig.ProblemMatcher>value; taskConfiguration.ts
1291 > return { value: new ProblemMatcherParser(context.problemReporter).parse(json) };
1292 > }
1293 }
1294 }
1432 const configProblemMatcher = ProblemMatcherConverter.fromWithOsConfig(external, context);
1433 if (configProblemMatcher.value !== undefined) {
1434 > result.problemMatchers = configProblemMatcher.value; taskConfiguration.ts
1435 > }
1436 if (external.detail) {
1437 result.detail = external.detail;
src/vs/base/common/parsers.ts 2 introduced LOC · 1 range

Open complete file

59
60 public get problemReporter(): IProblemReporter {
61 > return this._problemReporter; parsers.ts
62 > }
63
64 public info(message: string): void {