diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-20 17:50:39 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-20 17:50:39 +0000 |
commit | 04dacb994349848873f9b2576d53685630883300 (patch) | |
tree | 09c442a5a857b0dc47ad972aea84235f70dbf60c /editors/code | |
parent | f761ed2abb3faa07f9a835e9ba767954ca2e684b (diff) | |
parent | bf99a6eb084ea6a2ad105bc7328334a769db788c (diff) |
Merge #3252
3252: Improve integration with token color configuration r=matklad a=eaglgenes101
First, the extension now checks theme token color customizations as well as global token color customizations when determining what colors to highlight syntax with. Theme token color customizations take precedence over both global token color customizations and the theme token colors.
Second, a few additional token color customization keys used by other themes are added. The original paths still take precedence, but now turning on rust analyzer syntax highlighting should now not unexpectedly homogenize token colors when custom themes are used.
Co-authored-by: eaglgenes101 <[email protected]>
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/src/color_theme.ts | 8 | ||||
-rw-r--r-- | editors/code/src/highlighting.ts | 8 |
2 files changed, 10 insertions, 6 deletions
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 { | |||
83 | res.mergeFrom(loadThemeFile(themePath)); | 83 | res.mergeFrom(loadThemeFile(themePath)); |
84 | } | 84 | } |
85 | 85 | ||
86 | const customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); | 86 | const global_customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); |
87 | res.mergeFrom(ColorTheme.fromRules(customizations?.textMateRules ?? [])); | 87 | res.mergeFrom(ColorTheme.fromRules(global_customizations?.textMateRules ?? [])); |
88 | |||
89 | const theme_customizations: any = vscode.workspace.getConfiguration('editor.tokenColorCustomizations').get(`[${themeName}]`); | ||
90 | res.mergeFrom(ColorTheme.fromRules(theme_customizations?.textMateRules ?? [])); | ||
91 | |||
88 | 92 | ||
89 | return res; | 93 | return res; |
90 | } | 94 | } |
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<string, string[]>([ | |||
233 | ["type", ["entity.name.type"]], | 233 | ["type", ["entity.name.type"]], |
234 | ["type.builtin", ["entity.name.type", "support.type.primitive"]], | 234 | ["type.builtin", ["entity.name.type", "support.type.primitive"]], |
235 | ["type.self", ["entity.name.type.parameter.self"]], | 235 | ["type.self", ["entity.name.type.parameter.self"]], |
236 | ["type.param", ["entity.name.type.parameter"]], | 236 | ["type.param", ["entity.name.type.parameter", "entity.name.type.param.rust"]], |
237 | ["type.lifetime", ["entity.name.type.lifetime"]], | 237 | ["type.lifetime", ["entity.name.type.lifetime", "entity.name.lifetime.rust"]], |
238 | 238 | ||
239 | ["literal.byte", ["constant.character.byte"]], | 239 | ["literal.byte", ["constant.character.byte"]], |
240 | ["literal.char", ["constant.character"]], | 240 | ["literal.char", ["constant.character.rust"]], |
241 | ["literal.numeric", ["constant.numeric"]], | 241 | ["literal.numeric", ["constant.numeric"]], |
242 | 242 | ||
243 | ["comment", ["comment"]], | 243 | ["comment", ["comment"]], |
244 | ["string", ["string.quoted"]], | 244 | ["string", ["string.quoted"]], |
245 | ["attribute", ["meta.attribute"]], | 245 | ["attribute", ["meta.attribute.rust"]], |
246 | 246 | ||
247 | ["keyword", ["keyword"]], | 247 | ["keyword", ["keyword"]], |
248 | ["keyword.unsafe", ["keyword.other.unsafe"]], | 248 | ["keyword.unsafe", ["keyword.other.unsafe"]], |