184
return value;
185
}
187
>
public getColorMap(): Color[] {
188
return this._id2color.slice(0);
189
}
191
>
}
192
>
193
>
export class TokenTheme {
194
>
195
>
public static createFromRawTokenTheme(source: ITokenThemeRule[], customTokenColors: string[]): TokenTheme {
196
return this.createFromParsedTokenTheme(parseTokenTheme(source), customTokenColors);
197
}
199
>
public static createFromParsedTokenTheme(source: ParsedTokenThemeRule[], customTokenColors: string[]): TokenTheme {
200
return resolveParsedTokenThemeRules(source, customTokenColors);
201
}
203
>
private readonly _colorMap: ColorMap;
204
>
private readonly _root: ThemeTrieElement;
205
>
private readonly _cache: Map<string, number>;
206
>
207
>
constructor(colorMap: ColorMap, root: ThemeTrieElement) {
208
this._colorMap = colorMap;
209
this._root = root;
210
this._cache = new Map<string, number>();
211
}
213
>
public getColorMap(): Color[] {
214
return this._colorMap.getColorMap();
215
}
217
>
/**
218
>
* used for testing purposes
219
>
*/
220
>
public getThemeTrieElement(): ExternalThemeTrieElement {
221
return this._root.toExternalThemeTrieElement();
222
}
224
>
public _match(token: string): ThemeTrieElementRule {
225
return this._root.match(token);
226
}
228
>
public match(languageId: LanguageId, token: string): number {
229
// The cache contains the metadata without the language bits set.
230
let result = this._cache.get(token);