aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-03-02 13:45:20 +0000
committerAleksey Kladov <[email protected]>2020-03-02 13:46:46 +0000
commitdbd1698e02da46af308740aba193872e1f760490 (patch)
tree5aa78827742bde6b7585acb23da640d292e5b2f3 /editors/code
parent02f761ba4bd356ef2aeae5ed8bdd750c57ade30d (diff)
Don't fail loudly if the old highlighting breaks
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/src/highlighting.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts
index 3e0cbdc56..d7d0e910b 100644
--- a/editors/code/src/highlighting.ts
+++ b/editors/code/src/highlighting.ts
@@ -159,7 +159,9 @@ function initDecorations(): Map<string, vscode.TextEditorDecorationType> {
159 const theme = ColorTheme.load(); 159 const theme = ColorTheme.load();
160 const res = new Map(); 160 const res = new Map();
161 TAG_TO_SCOPES.forEach((scopes, tag) => { 161 TAG_TO_SCOPES.forEach((scopes, tag) => {
162 if (!scopes) throw `unmapped tag: ${tag}`; 162 // We are going to axe this soon, so don't try to detect unknown tags.
163 // Users should switch to the new semantic tokens implementation.
164 if (!scopes) return;
163 const rule = theme.lookup(scopes); 165 const rule = theme.lookup(scopes);
164 const decor = createDecorationFromTextmate(rule); 166 const decor = createDecorationFromTextmate(rule);
165 res.set(tag, decor); 167 res.set(tag, decor);
@@ -211,7 +213,7 @@ const TAG_TO_SCOPES = new Map<string, string[]>([
211 ["macro", ["entity.name.macro"]], 213 ["macro", ["entity.name.macro"]],
212 214
213 ["variable", ["variable"]], 215 ["variable", ["variable"]],
214 ["variable.mut", ["variable", "meta.mutable"]], 216 ["variable.mutable", ["variable", "meta.mutable"]],
215 217
216 ["type", ["entity.name.type"]], 218 ["type", ["entity.name.type"]],
217 ["type.builtin", ["entity.name.type", "support.type.primitive"]], 219 ["type.builtin", ["entity.name.type", "support.type.primitive"]],
@@ -221,10 +223,10 @@ const TAG_TO_SCOPES = new Map<string, string[]>([
221 223
222 ["literal.byte", ["constant.character.byte"]], 224 ["literal.byte", ["constant.character.byte"]],
223 ["literal.char", ["constant.character.rust"]], 225 ["literal.char", ["constant.character.rust"]],
224 ["literal.numeric", ["constant.numeric"]], 226 ["numeric_literal", ["constant.numeric"]],
225 227
226 ["comment", ["comment"]], 228 ["comment", ["comment"]],
227 ["string", ["string.quoted"]], 229 ["string_literal", ["string.quoted"]],
228 ["attribute", ["meta.attribute.rust"]], 230 ["attribute", ["meta.attribute.rust"]],
229 231
230 ["keyword", ["keyword"]], 232 ["keyword", ["keyword"]],