From 1da08937d848c0cf3512f977fe52d02c6cd4aaaf Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 1 Mar 2022 16:17:16 -0800 Subject: [PATCH] Remove text mate highlighting of more JS/TS built-ins Identifying specific symbols is a better fit for semantic highlighting instead of textmate as semantic highlighting prevents false positives This keeps around a few of the most built-ins for now but we may revisit these in the future --- .../syntaxes/JavaScript.tmLanguage.json | 49 --------------- .../syntaxes/JavaScriptReact.tmLanguage.json | 49 --------------- .../build/update-grammars.mjs | 14 ++++- .../syntaxes/TypeScript.tmLanguage.json | 49 --------------- .../syntaxes/TypeScriptReact.tmLanguage.json | 49 --------------- .../colorize-results/test-brackets_tsx.json | 10 ++-- .../colorize-results/test-keywords_ts.json | 10 ++-- .../test/colorize-results/test_html.json | 10 ++-- .../test/colorize-results/test_js.json | 60 +++++++++---------- .../test/colorize-results/test_ts.json | 30 +++++----- 10 files changed, 73 insertions(+), 257 deletions(-) diff --git a/extensions/javascript/syntaxes/JavaScript.tmLanguage.json b/extensions/javascript/syntaxes/JavaScript.tmLanguage.json index 5eab3c69bd1..405006f6e29 100644 --- a/extensions/javascript/syntaxes/JavaScript.tmLanguage.json +++ b/extensions/javascript/syntaxes/JavaScript.tmLanguage.json @@ -3566,59 +3566,10 @@ "name": "variable.language.arguments.js", "match": "(? { - if (pattern.match && /\b(HTMLElement|ATTRIBUTE_NODE|stopImmediatePropagation)\b/g.test(pattern.match)) { + if (pattern.match && ( + /\b(HTMLElement|ATTRIBUTE_NODE|stopImmediatePropagation)\b/g.test(pattern.match) + || /\bJSON\b/g.test(pattern.match) + || /\bMath\b/g.test(pattern.match) + )) { return false; } + + if (pattern.name?.startsWith('support.class.error.') + || pattern.name?.startsWith('support.class.builtin.') + || pattern.name?.startsWith('support.function.') + ) { + return false; + } + return true; }); return grammar; diff --git a/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json b/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json index 5ff736e03dc..950e0afeeec 100644 --- a/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json +++ b/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json @@ -3615,59 +3615,10 @@ "name": "variable.language.arguments.ts", "match": "(?