diff --git a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts index 52d30eb44b1..6557111c496 100644 --- a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts +++ b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts @@ -34,16 +34,16 @@ export function activate(context: vscode.ExtensionContext): any { result.push(startCharacter + length); - const segments = property.split('.'); - let tokenType = legend.tokenTypes.indexOf(segments[0]); + const [type, ...modifiers] = property.split('.'); + let tokenType = legend.tokenTypes.indexOf(type); if (tokenType === -1) { tokenType = 0; } result.push(tokenType); let tokenModifiers = 0; - for (let i = 1; i < segments.length; i++) { - const index = legend.tokenTypes.indexOf(segments[0]); + for (let i = 0; i < modifiers.length; i++) { + const index = legend.tokenModifiers.indexOf(modifiers[i]); if (index !== -1) { tokenModifiers = tokenModifiers | 1 << index; } diff --git a/src/vs/editor/common/services/modelServiceImpl.ts b/src/vs/editor/common/services/modelServiceImpl.ts index e5c133c4573..3793c1ae50e 100644 --- a/src/vs/editor/common/services/modelServiceImpl.ts +++ b/src/vs/editor/common/services/modelServiceImpl.ts @@ -476,6 +476,7 @@ class ModelSemanticColoring extends Disposable { this._register(this._model.onDidChangeContent(e => this._fetchSemanticTokens.schedule())); this._register(SemanticColoringProviderRegistry.onDidChange(e => this._fetchSemanticTokens.schedule())); + this._register(themeService.onThemeChange(_ => this._fetchSemanticTokens.schedule())); this._fetchSemanticTokens.schedule(0); } @@ -554,12 +555,13 @@ class ModelSemanticColoring extends Disposable { const tokenTypeIndex = srcTokens[srcOffset + 3]; const tokenType = legend.tokenTypes[tokenTypeIndex]; - const tokenModifierSet = srcTokens[srcOffset + 4]; + let tokenModifierSet = srcTokens[srcOffset + 4]; let tokenModifiers: string[] = []; for (let modifierIndex = 0; tokenModifierSet !== 0 && modifierIndex < legend.tokenModifiers.length; modifierIndex++) { if (tokenModifierSet & 1) { - tokenModifiers.push(legend.tokenTypes[modifierIndex]); + tokenModifiers.push(legend.tokenModifiers[modifierIndex]); } + tokenModifierSet = tokenModifierSet >> 1; } const metadata = this._themeService.getTheme().getTokenStyleMetadata(tokenType, tokenModifiers); diff --git a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts index df7c4cfd196..c0172a4cdd8 100644 --- a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts @@ -364,10 +364,12 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { this.currentColorTheme = themeData; themeData.setCustomColors(this.colorCustomizations); themeData.setCustomTokenColors(this.tokenColorCustomizations); + themeData.setCustomTokenStyleRules(this.tokenStylesCustomizations); return Promise.resolve(themeData); } themeData.setCustomColors(this.colorCustomizations); themeData.setCustomTokenColors(this.tokenColorCustomizations); + themeData.setCustomTokenStyleRules(this.tokenStylesCustomizations); this.updateDynamicCSSRules(themeData); return this.applyTheme(themeData, settingsTarget); }, error => { @@ -380,6 +382,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { await this.currentColorTheme.reload(this.extensionResourceLoaderService); this.currentColorTheme.setCustomColors(this.colorCustomizations); this.currentColorTheme.setCustomTokenColors(this.tokenColorCustomizations); + this.currentColorTheme.setCustomTokenStyleRules(this.tokenStylesCustomizations); this.updateDynamicCSSRules(this.currentColorTheme); this.applyTheme(this.currentColorTheme, undefined, false); } diff --git a/src/vs/workbench/services/themes/common/colorThemeData.ts b/src/vs/workbench/services/themes/common/colorThemeData.ts index aca8cb6d688..9639f59e0d1 100644 --- a/src/vs/workbench/services/themes/common/colorThemeData.ts +++ b/src/vs/workbench/services/themes/common/colorThemeData.ts @@ -340,12 +340,12 @@ export class ColorThemeData implements IColorTheme { } public setCustomTokenStyleRules(tokenStylingRules: IExperimentalTokenStyleCustomizations) { - this.tokenStylingRules = []; - readCustomTokenStyleRules(tokenStylingRules, this.tokenStylingRules); + this.customTokenStylingRules = []; + readCustomTokenStyleRules(tokenStylingRules, this.customTokenStylingRules); const themeSpecificColors = tokenStylingRules[`[${this.settingsId}]`] as IExperimentalTokenStyleCustomizations; if (types.isObject(themeSpecificColors)) { - readCustomTokenStyleRules(themeSpecificColors, this.tokenStylingRules); + readCustomTokenStyleRules(themeSpecificColors, this.customTokenStylingRules); } this.tokenColorIndex = undefined;