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
This commit is contained in:
Matt Bierner
2022-03-01 16:17:16 -08:00
parent b391749606
commit 1da08937d8
10 changed files with 73 additions and 257 deletions

View File

@@ -8,9 +8,21 @@ import { update } from 'vscode-grammar-updater';
function removeDom(grammar) {
grammar.repository['support-objects'].patterns = grammar.repository['support-objects'].patterns.filter(pattern => {
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;