src/vs/workbench/services/themes/common/textMateScopeMatcher.ts

134 LOC · 81 covered · 53 uncovered · 14 ranges · 20 concepts · 3 introducers · 7 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

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 related-file, concept, and source links on this page.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the filesrc/vs/platform/extensionManagement/common/extensionGalleryManifestService.ts · 228 LOCcommon/extensionGalleryM…src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts · 171 LOCcommon/extensionResource…src/vs/platform/extensionResourceLoader/common/extensionResourceLoaderService.ts · 46 LOCcommon/extensionResource…src/vs/platform/theme/common/tokenClassificationRegistry.ts · 632 LOCcommon/tokenClassificati…src/vs/workbench/services/themes/common/colorThemeData.ts · 1083 LOCcommon/colorThemeData.tssrc/vs/workbench/services/themes/common/plistParser.ts · 492 LOCcommon/plistParser.tssrc/vs/workbench/services/themes/common/themeCompatibility.ts · 76 LOCcommon/themeCompatibilit…colorThemeData.ts ×16 · 64 introduced LOCcolorThemeData.ts ×16tokenClassificationRegistry.ts ×1 · 3 introduced LOCtokenClassificationRegis…tokenClassificationRegistry.ts ×2 · 7 introduced LOCtokenClassificationRegis…tokenStyleResolving.test|title=Themes - TokenStyleResolving language|occurrence=1 · 0 introduced LOCtokenStyleResolving.test…colorThemeData.ts ×1 · 2 introduced LOCcolorThemeData.ts ×1colorThemeData.ts ×12 · 57 introduced LOCcolorThemeData.ts ×12tokenClassificationRegistry.ts ×2 · 6 introduced LOCtokenClassificationRegis…colorThemeData.ts ×5 · 21 introduced LOCcolorThemeData.ts ×5colorThemeData.ts ×1 · 6 introduced LOCcolorThemeData.ts ×1colorThemeData.ts ×33 · 242 introduced LOCcolorThemeData.ts ×33colorThemeData.ts ×2 · 5 introduced LOCcolorThemeData.ts ×2tokenStyleResolving.test|title=Themes - TokenStyleResolving resolveScopes - match most specific|occurrence=1 · 0 introduced LOCtokenStyleResolving.test…colorThemeData.ts ×5 · 33 introduced LOCcolorThemeData.ts ×5colorThemeData.ts ×1 · 4 introduced LOCcolorThemeData.ts ×1tokenClassificationRegistry.ts ×1 · 16 introduced LOCtokenClassificationRegis…colorThemeData.ts ×1 · 1 introduced LOCcolorThemeData.ts ×1colorThemeData.ts ×13 · 114 introduced LOCcolorThemeData.ts ×13colorThemeData.ts ×1 · 1 introduced LOCcolorThemeData.ts ×1colorThemeData.ts ×4 · 15 introduced LOCcolorThemeData.ts ×4colorThemeData.ts ×57 · 483 introduced LOCcolorThemeData.ts ×57tokenStyleResolving.test|title=Themes - TokenStyleResolving color defaults|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving color defaults|occurrence=1tokenStyleResolving.test…tokenStyleResolving.test|title=Themes - TokenStyleResolving language - scope resolving|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving language - scope resolving|occurrence=1tokenStyleResolving.test…tokenStyleResolving.test|title=Themes - TokenStyleResolving language|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving language|occurrence=1tokenStyleResolving.test…tokenStyleResolving.test|title=Themes - TokenStyleResolving resolveScopes - match most specific|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving resolveScopes - match most specific|occurrence=1tokenStyleResolving.test…tokenStyleResolving.test|title=Themes - TokenStyleResolving resolveScopes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving resolveScopes|occurrence=1tokenStyleResolving.test…tokenStyleResolving.test|title=Themes - TokenStyleResolving rule matching|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving rule matching|occurrence=1tokenStyleResolving.test…tokenStyleResolving.test|title=Themes - TokenStyleResolving super type|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/services/themes/test/node/tokenStyleResolving.test|title=Themes - TokenStyleResolving super type|occurrence=1tokenStyleResolving.test…Focused file · src/vs/workbench/services/themes/common/textMateScopeMatcher.ts · 134 LOCcommon/textMateScopeMatc…

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- colorThemeData.ts ×57
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > 'use strict';
7 >
8 > export interface MatcherWithPriority<T> {
9 > matcher: Matcher<T>;
10 > priority: -1 | 0 | 1;
11 > }
12 >
13 > export interface Matcher<T> {
14 > (matcherInput: T): number;
15 > }
16 >
17 > export function createMatchers<T>(selector: string, matchesName: (names: string[], matcherInput: T) => number, results: MatcherWithPriority<T>[]): void {
18 > const tokenizer = newTokenizer(selector); colorThemeData.ts ×13
19 > let token = tokenizer.next();
20 > while (token !== null) {
21 > let priority: -1 | 0 | 1 = 0;
22 > if (token.length === 2 && token.charAt(1) === ':') {
23 switch (token.charAt(0)) {
24 case 'R': priority = 1; break;
25 case 'L': priority = -1; break;
26 default:
27 console.log(`Unknown priority ${token} in scope selector`);
28 }
29 token = tokenizer.next();
30 }
31 > const matcher = parseConjunction(); colorThemeData.ts ×13
32 > if (matcher) {
33 > results.push({ matcher, priority });
34 > }
35 > if (token !== ',') {
36 > break;
37 > }
38 > token = tokenizer.next(); colorThemeData.ts ×1
39 > }
41 > function parseOperand(): Matcher<T> | null {
42 > if (token === '-') {
43 token = tokenizer.next();
44 const expressionToNegate = parseOperand();
45 if (!expressionToNegate) {
46 return null;
47 }
48 return matcherInput => {
49 const score = expressionToNegate(matcherInput);
50 return score < 0 ? 0 : -1;
51 };
52 }
53 > if (token === '(') { colorThemeData.ts ×13
54 token = tokenizer.next();
55 const expressionInParents = parseInnerExpression();
56 if (token === ')') {
57 token = tokenizer.next();
58 }
59 return expressionInParents;
60 }
61 > if (isIdentifier(token)) { colorThemeData.ts ×13
62 > const identifiers: string[] = [];
63 > do {
64 > identifiers.push(token);
65 > token = tokenizer.next();
66 > } while (isIdentifier(token));
67 > return matcherInput => matchesName(identifiers, matcherInput);
68 > }
69 > return null;
70 > }
71 > function parseConjunction(): Matcher<T> | null {
72 > let matcher = parseOperand();
73 > if (!matcher) {
74 return null;
75 }
77 > const matchers: Matcher<T>[] = [];
78 > while (matcher) {
79 > matchers.push(matcher);
80 > matcher = parseOperand();
81 > }
82 > return matcherInput => { // and
83 > let min = matchers[0](matcherInput);
84 > for (let i = 1; min >= 0 && i < matchers.length; i++) {
85 min = Math.min(min, matchers[i](matcherInput));
86 }
87 > return min; colorThemeData.ts ×13
88 > };
89 > }
90 > function parseInnerExpression(): Matcher<T> | null {
91 let matcher = parseConjunction();
92 if (!matcher) {
93 return null;
94 }
95 const matchers: Matcher<T>[] = [];
96 while (matcher) {
97 matchers.push(matcher);
98 if (token === '|' || token === ',') {
99 do {
100 token = tokenizer.next();
101 } while (token === '|' || token === ','); // ignore subsequent commas
102 } else {
103 break;
104 }
105 matcher = parseConjunction();
106 }
107 return matcherInput => { // or
108 let max = matchers[0](matcherInput);
109 for (let i = 1; i < matchers.length; i++) {
110 max = Math.max(max, matchers[i](matcherInput));
111 }
112 return max;
113 };
114 }
117 > function isIdentifier(token: string | null): token is string { colorThemeData.ts ×13
118 > return !!token && !!token.match(/[\w\.:]+/);
119 > }
121 > function newTokenizer(input: string): { next: () => string | null } { colorThemeData.ts ×13
122 > const regex = /([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g;
123 > let match = regex.exec(input);
124 > return {
125 > next: () => {
126 > if (!match) {
127 > return null;
128 > }
129 > const res = match[0];
130 > match = regex.exec(input);
131 > return res;
132 > }
133 > };
134 > }