|
6 | 6 | import * as dom from 'vs/base/browser/dom'; |
7 | 7 | import { Color } from 'vs/base/common/color'; |
8 | 8 | import { Emitter } from 'vs/base/common/event'; |
9 | | -import { TokenizationRegistry } from 'vs/editor/common/modes'; |
| 9 | +import { FontStyle, TokenizationRegistry, TokenMetadata } from 'vs/editor/common/modes'; |
10 | 10 | import { ITokenThemeRule, TokenTheme, generateTokensCSSForColorMap } from 'vs/editor/common/modes/supports/tokenization'; |
11 | 11 | import { BuiltinTheme, IStandaloneTheme, IStandaloneThemeData, IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService'; |
12 | 12 | import { hc_black, vs, vs_dark } from 'vs/editor/standalone/common/themes'; |
@@ -137,7 +137,17 @@ class StandaloneTheme implements IStandaloneTheme { |
137 | 137 | } |
138 | 138 |
|
139 | 139 | public getTokenStyleMetadata(type: string, modifiers: string[], modelLanguage: string): ITokenStyle | undefined { |
140 | | - return undefined; |
| 140 | + // use theme rules match |
| 141 | + const style = this.tokenTheme._match([type].concat(modifiers).join('.')); |
| 142 | + const metadata = style.metadata; |
| 143 | + const foreground = TokenMetadata.getForeground(metadata); |
| 144 | + const fontStyle = TokenMetadata.getFontStyle(metadata); |
| 145 | + return { |
| 146 | + foreground: foreground, |
| 147 | + italic: Boolean(fontStyle & FontStyle.Italic), |
| 148 | + bold: Boolean(fontStyle & FontStyle.Bold), |
| 149 | + underline: Boolean(fontStyle & FontStyle.Underline) |
| 150 | + }; |
141 | 151 | } |
142 | 152 |
|
143 | 153 | public get tokenColorMap(): string[] { |
|
0 commit comments