colorThemeData.ts ×12

Frontier kind: Joint frontier

unlabeled · c_1a7393c649f7

3 tests · 31857 LOC · 176 files · introduces 1 test · 57 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges57 lines · 1 files
Tests
1 test

Contains — complete concept membership

All code (extent)
3502 ranges31857 lines · 176 files · Browse complete extent
All tests (intent)
3 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.

1 test introduced at this concept.

Introduced code

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

1 file ranked by introduced lines: 57 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/services/themes/common/colorThemeData.ts 57 introduced LOC · 12 ranges

Open complete file

204 }
205 function _processSemanticTokenRule(rule: SemanticTokenRule) {
206 > const matchScore = rule.selector.match(type, modifiers, language); colorThemeData.ts
207 > if (matchScore >= 0) {
208 > _processStyle(matchScore, rule.style, rule);
209 > }
210 > }
211
212 this.semanticTokenRules.forEach(_processSemanticTokenRule);
219 hasUndefinedStyleProperty = true;
220 } else {
221 > score[key] = Number.MAX_VALUE; // set it to the max, so it won't be replaced by a default colorThemeData.ts
222 > }
223 }
224 if (hasUndefinedStyleProperty) {
234 }
235 if (!style && useDefault !== false) {
236 > const tokenStyleValue = rule.defaults[this.type]; colorThemeData.ts
237 > style = this.resolveTokenStyleValue(tokenStyleValue);
238 > if (style) {
239 _processStyle(matchScore, style, tokenStyleValue!);
240 }
242 }
243 }
251 */
252 public resolveTokenStyleValue(tokenStyleValue: TokenStyleValue | undefined): TokenStyle | undefined {
253 > if (tokenStyleValue === undefined) { colorThemeData.ts
254 > return undefined;
255 > } else if (typeof tokenStyleValue === 'string') {
256 const { type, modifiers, language } = parseClassifierString(tokenStyleValue, '');
257 return this.getTokenStyle(type, modifiers, language);
260 }
261 return undefined;
263
264 public getTokenColorIndex(): TokenColorIndex {
445
446 public setCustomSemanticTokenColors(semanticTokenColors: ISemanticTokenColorCustomizations | undefined) {
447 > this.customSemanticTokenRules = []; colorThemeData.ts
448 > this.customSemanticHighlighting = undefined;
449 >
450 > if (semanticTokenColors) {
451 > this.customSemanticHighlighting = semanticTokenColors.enabled;
452 > if (semanticTokenColors.rules) {
453 > this.readSemanticTokenRules(semanticTokenColors.rules);
454 > }
455 > const themeSpecificColors = this.getThemeSpecificColors(semanticTokenColors) as ISemanticTokenColorCustomizations;
456 > if (types.isObject(themeSpecificColors)) {
457 if (themeSpecificColors.enabled !== undefined) {
458 this.customSemanticHighlighting = themeSpecificColors.enabled;
462 }
463 }
465 >
466 > this.tokenColorIndex = undefined;
467 > this.tokenFontIndex = undefined;
468 > this.textMateThemingRules = undefined;
469 > }
470
471 public isThemeScope(key: string): boolean {
515
516 private readSemanticTokenRules(tokenStylingRuleSection: ISemanticTokenRules) {
517 > for (const key in tokenStylingRuleSection) { colorThemeData.ts
518 > if (!this.isThemeScope(key)) { // still do this test until experimental settings are gone
519 > try {
520 > const rule = readSemanticTokenRule(key, tokenStylingRuleSection[key]);
521 > if (rule) {
522 > this.customSemanticTokenRules.push(rule);
523 > }
524 > } catch (e) {
525 // invalid selector, ignore
526 }
528 > }
529 > }
530
531 private addCustomTokenColors(customTokenColors: ITokenColorCustomizations) {
904 }
905
906 > function readSemanticTokenRule(selectorString: string, settings: ISemanticTokenColorizationSetting | string | boolean | undefined): SemanticTokenRule | undefined { colorThemeData.ts
907 > const selector = tokenClassificationRegistry.parseTokenSelector(selectorString);
908 > let style: TokenStyle | undefined;
909 > if (typeof settings === 'string') {
910 > style = TokenStyle.fromSettings(settings, undefined);
911 > } else if (isSemanticTokenColorizationSetting(settings)) {
912 > style = TokenStyle.fromSettings(settings.foreground, settings.fontStyle, settings.bold, settings.underline, settings.strikethrough, settings.italic);
913 > }
914 > if (style) {
915 > return { selector, style };
916 > }
917 return undefined;
918 }
919
920 > function isSemanticTokenColorizationSetting(style: any): style is ISemanticTokenColorizationSetting { colorThemeData.ts
921 > return style && (types.isString(style.foreground) || types.isString(style.fontStyle) || types.isBoolean(style.italic)
922 > || types.isBoolean(style.underline) || types.isBoolean(style.strikethrough) || types.isBoolean(style.bold));
923 > }
924
925 export function findMetadata(colorThemeData: ColorThemeData, captureNames: string[], languageId: number, bracket: boolean): number {