mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 14:51:48 +00:00
Don't fail loudly if the old highlighting breaks
This commit is contained in:
parent
02f761ba4b
commit
dbd1698e02
1 changed files with 6 additions and 4 deletions
|
@ -159,7 +159,9 @@ function initDecorations(): Map<string, vscode.TextEditorDecorationType> {
|
||||||
const theme = ColorTheme.load();
|
const theme = ColorTheme.load();
|
||||||
const res = new Map();
|
const res = new Map();
|
||||||
TAG_TO_SCOPES.forEach((scopes, tag) => {
|
TAG_TO_SCOPES.forEach((scopes, tag) => {
|
||||||
if (!scopes) throw `unmapped tag: ${tag}`;
|
// We are going to axe this soon, so don't try to detect unknown tags.
|
||||||
|
// Users should switch to the new semantic tokens implementation.
|
||||||
|
if (!scopes) return;
|
||||||
const rule = theme.lookup(scopes);
|
const rule = theme.lookup(scopes);
|
||||||
const decor = createDecorationFromTextmate(rule);
|
const decor = createDecorationFromTextmate(rule);
|
||||||
res.set(tag, decor);
|
res.set(tag, decor);
|
||||||
|
@ -211,7 +213,7 @@ const TAG_TO_SCOPES = new Map<string, string[]>([
|
||||||
["macro", ["entity.name.macro"]],
|
["macro", ["entity.name.macro"]],
|
||||||
|
|
||||||
["variable", ["variable"]],
|
["variable", ["variable"]],
|
||||||
["variable.mut", ["variable", "meta.mutable"]],
|
["variable.mutable", ["variable", "meta.mutable"]],
|
||||||
|
|
||||||
["type", ["entity.name.type"]],
|
["type", ["entity.name.type"]],
|
||||||
["type.builtin", ["entity.name.type", "support.type.primitive"]],
|
["type.builtin", ["entity.name.type", "support.type.primitive"]],
|
||||||
|
@ -221,10 +223,10 @@ const TAG_TO_SCOPES = new Map<string, string[]>([
|
||||||
|
|
||||||
["literal.byte", ["constant.character.byte"]],
|
["literal.byte", ["constant.character.byte"]],
|
||||||
["literal.char", ["constant.character.rust"]],
|
["literal.char", ["constant.character.rust"]],
|
||||||
["literal.numeric", ["constant.numeric"]],
|
["numeric_literal", ["constant.numeric"]],
|
||||||
|
|
||||||
["comment", ["comment"]],
|
["comment", ["comment"]],
|
||||||
["string", ["string.quoted"]],
|
["string_literal", ["string.quoted"]],
|
||||||
["attribute", ["meta.attribute.rust"]],
|
["attribute", ["meta.attribute.rust"]],
|
||||||
|
|
||||||
["keyword", ["keyword"]],
|
["keyword", ["keyword"]],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue