Skip to content

Commit

Permalink
Add a temporary implementation for semantic tokens styling (for micro…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima authored and meganrogge committed Sep 22, 2020
1 parent 2ce01eb commit 89badec
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import * as dom from 'vs/base/browser/dom';
import { Color } from 'vs/base/common/color';
import { Emitter } from 'vs/base/common/event';
import { TokenizationRegistry } from 'vs/editor/common/modes';
import { FontStyle, TokenizationRegistry, TokenMetadata } from 'vs/editor/common/modes';
import { ITokenThemeRule, TokenTheme, generateTokensCSSForColorMap } from 'vs/editor/common/modes/supports/tokenization';
import { BuiltinTheme, IStandaloneTheme, IStandaloneThemeData, IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
import { hc_black, vs, vs_dark } from 'vs/editor/standalone/common/themes';
Expand Down Expand Up @@ -137,7 +137,17 @@ class StandaloneTheme implements IStandaloneTheme {
}

public getTokenStyleMetadata(type: string, modifiers: string[], modelLanguage: string): ITokenStyle | undefined {
return undefined;
// use theme rules match
const style = this.tokenTheme._match([type].concat(modifiers).join('.'));
const metadata = style.metadata;
const foreground = TokenMetadata.getForeground(metadata);
const fontStyle = TokenMetadata.getFontStyle(metadata);
return {
foreground: foreground,
italic: Boolean(fontStyle & FontStyle.Italic),
bold: Boolean(fontStyle & FontStyle.Bold),
underline: Boolean(fontStyle & FontStyle.Underline)
};
}

public get tokenColorMap(): string[] {
Expand Down

0 comments on commit 89badec

Please sign in to comment.