From 358b9d685fc289e0ad2bff5cb0508e8ad383b7ff Mon Sep 17 00:00:00 2001 From: eaglgenes101 Date: Thu, 20 Feb 2020 12:40:12 -0500 Subject: Improved compatibility with themes --- editors/code/src/color_theme.ts | 8 ++++++-- editors/code/src/highlighting.ts | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'editors') diff --git a/editors/code/src/color_theme.ts b/editors/code/src/color_theme.ts index a6957a76e..2f2a39877 100644 --- a/editors/code/src/color_theme.ts +++ b/editors/code/src/color_theme.ts @@ -83,8 +83,12 @@ function loadThemeNamed(themeName: string): ColorTheme { res.mergeFrom(loadThemeFile(themePath)); } - const customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); - res.mergeFrom(ColorTheme.fromRules(customizations?.textMateRules ?? [])); + const global_customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); + res.mergeFrom(ColorTheme.fromRules(global_customizations?.textMateRules ?? [])); + + const theme_customizations: any = vscode.workspace.getConfiguration('editor.tokenColorCustomizations').get(`[${themeName}]`); + res.mergeFrom(ColorTheme.fromRules(theme_customizations?.textMateRules ?? [])); + return res; } diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index c4d286aef..b34e49c17 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts @@ -233,16 +233,16 @@ const TAG_TO_SCOPES = new Map([ ["type", ["entity.name.type"]], ["type.builtin", ["entity.name.type", "support.type.primitive"]], ["type.self", ["entity.name.type.parameter.self"]], - ["type.param", ["entity.name.type.parameter"]], - ["type.lifetime", ["entity.name.type.lifetime"]], + ["type.param", ["entity.name.type.parameter", "entity.name.type.param.rust"]], + ["type.lifetime", ["entity.name.type.lifetime", "entity.name.lifetime.rust"]], ["literal.byte", ["constant.character.byte"]], - ["literal.char", ["constant.character"]], + ["literal.char", ["constant.character.rust"]], ["literal.numeric", ["constant.numeric"]], ["comment", ["comment"]], ["string", ["string.quoted"]], - ["attribute", ["meta.attribute"]], + ["attribute", ["meta.attribute.rust"]], ["keyword", ["keyword"]], ["keyword.unsafe", ["keyword.other.unsafe"]], -- cgit v1.2.3