Don't treat dom properties as special for syntax highlighting
See https://github.com/Microsoft/TypeScript-TmLanguage/issues/691 Assuming that properties named `label` or `name` are dom properties is incorrect and causes a lot of false positives. This results in weirdly inconsistent colorizationpull/65941/head
parent
5631529791
commit
5ed55a8606
|
@ -111,13 +111,13 @@
|
|||
},
|
||||
{
|
||||
"c": "window",
|
||||
"t": "text.html.derivative meta.embedded.block.html source.js meta.function-call.js support.variable.dom.js",
|
||||
"t": "text.html.derivative meta.embedded.block.html source.js meta.function-call.js variable.other.object.js",
|
||||
"r": {
|
||||
"dark_plus": "support.variable: #9CDCFE",
|
||||
"light_plus": "support.variable: #001080",
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "meta.embedded: #D4D4D4",
|
||||
"light_vs": "meta.embedded: #000000",
|
||||
"hc_black": "support.variable: #9CDCFE"
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -133,13 +133,13 @@
|
|||
},
|
||||
{
|
||||
"c": "alert",
|
||||
"t": "text.html.derivative meta.embedded.block.html source.js meta.function-call.js support.function.js",
|
||||
"t": "text.html.derivative meta.embedded.block.html source.js meta.function-call.js entity.name.function.js",
|
||||
"r": {
|
||||
"dark_plus": "support.function: #DCDCAA",
|
||||
"light_plus": "support.function: #795E26",
|
||||
"dark_plus": "entity.name.function: #DCDCAA",
|
||||
"light_plus": "entity.name.function: #795E26",
|
||||
"dark_vs": "meta.embedded: #D4D4D4",
|
||||
"light_vs": "meta.embedded: #000000",
|
||||
"hc_black": "support.function: #DCDCAA"
|
||||
"hc_black": "entity.name.function: #DCDCAA"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -298,13 +298,13 @@
|
|||
},
|
||||
{
|
||||
"c": "window",
|
||||
"t": "text.html.derivative meta.embedded.block.html source.js meta.function-call.js support.variable.dom.js",
|
||||
"t": "text.html.derivative meta.embedded.block.html source.js meta.function-call.js variable.other.object.js",
|
||||
"r": {
|
||||
"dark_plus": "support.variable: #9CDCFE",
|
||||
"light_plus": "support.variable: #001080",
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "meta.embedded: #D4D4D4",
|
||||
"light_vs": "meta.embedded: #000000",
|
||||
"hc_black": "support.variable: #9CDCFE"
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -320,13 +320,13 @@
|
|||
},
|
||||
{
|
||||
"c": "alert",
|
||||
"t": "text.html.derivative meta.embedded.block.html source.js meta.function-call.js support.function.js",
|
||||
"t": "text.html.derivative meta.embedded.block.html source.js meta.function-call.js entity.name.function.js",
|
||||
"r": {
|
||||
"dark_plus": "support.function: #DCDCAA",
|
||||
"light_plus": "support.function: #795E26",
|
||||
"dark_plus": "entity.name.function: #DCDCAA",
|
||||
"light_plus": "entity.name.function: #795E26",
|
||||
"dark_vs": "meta.embedded: #D4D4D4",
|
||||
"light_vs": "meta.embedded: #000000",
|
||||
"hc_black": "support.function: #DCDCAA"
|
||||
"hc_black": "entity.name.function: #DCDCAA"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -573,13 +573,13 @@
|
|||
},
|
||||
{
|
||||
"c": "preventDefault",
|
||||
"t": "source.js.jsx meta.var.expr.js.jsx meta.objectliteral.js.jsx meta.object.member.js.jsx meta.function.expression.js.jsx meta.block.js.jsx meta.function-call.js.jsx support.function.dom.js.jsx",
|
||||
"t": "source.js.jsx meta.var.expr.js.jsx meta.objectliteral.js.jsx meta.object.member.js.jsx meta.function.expression.js.jsx meta.block.js.jsx meta.function-call.js.jsx entity.name.function.js.jsx",
|
||||
"r": {
|
||||
"dark_plus": "support.function: #DCDCAA",
|
||||
"light_plus": "support.function: #795E26",
|
||||
"dark_plus": "entity.name.function: #DCDCAA",
|
||||
"light_plus": "entity.name.function: #795E26",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "support.function: #DCDCAA"
|
||||
"hc_black": "entity.name.function: #DCDCAA"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -1475,13 +1475,13 @@
|
|||
},
|
||||
{
|
||||
"c": "alt",
|
||||
"t": "source.js.jsx meta.var.expr.js.jsx meta.objectliteral.js.jsx meta.object.member.js.jsx meta.function.expression.js.jsx meta.block.js.jsx meta.block.js.jsx support.variable.property.dom.js.jsx",
|
||||
"t": "source.js.jsx meta.var.expr.js.jsx meta.objectliteral.js.jsx meta.object.member.js.jsx meta.function.expression.js.jsx meta.block.js.jsx meta.block.js.jsx variable.other.property.js.jsx",
|
||||
"r": {
|
||||
"dark_plus": "support.variable: #9CDCFE",
|
||||
"light_plus": "support.variable: #001080",
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "support.variable: #9CDCFE"
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -2344,13 +2344,13 @@
|
|||
},
|
||||
{
|
||||
"c": "document",
|
||||
"t": "source.js.jsx support.variable.dom.js.jsx",
|
||||
"t": "source.js.jsx variable.other.object.js.jsx",
|
||||
"r": {
|
||||
"dark_plus": "support.variable: #9CDCFE",
|
||||
"light_plus": "support.variable: #001080",
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "support.variable: #9CDCFE"
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -2366,13 +2366,13 @@
|
|||
},
|
||||
{
|
||||
"c": "body",
|
||||
"t": "source.js.jsx support.variable.property.dom.js.jsx",
|
||||
"t": "source.js.jsx variable.other.property.js.jsx",
|
||||
"r": {
|
||||
"dark_plus": "support.variable: #9CDCFE",
|
||||
"light_plus": "support.variable: #001080",
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "support.variable: #9CDCFE"
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -980,13 +980,13 @@
|
|||
},
|
||||
{
|
||||
"c": "name",
|
||||
"t": "text.pug text.block.pug string.interpolated.pug support.variable.property.dom.js",
|
||||
"t": "text.pug text.block.pug string.interpolated.pug variable.other.property.js",
|
||||
"r": {
|
||||
"dark_plus": "support.variable: #9CDCFE",
|
||||
"light_plus": "support.variable: #001080",
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "string: #CE9178",
|
||||
"light_vs": "string.interpolated.pug: #0000FF",
|
||||
"hc_black": "support.variable: #9CDCFE"
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -6,6 +6,16 @@
|
|||
|
||||
var updateGrammar = require('../../../build/npm/update-grammar');
|
||||
|
||||
function removeDom(grammar) {
|
||||
grammar.repository['support-objects'].patterns = grammar.repository['support-objects'].patterns.filter(pattern => {
|
||||
if (pattern.match && pattern.match.match(/\b(HTMLElement|ATTRIBUTE_NODE|stopImmediatePropagation)\b/g)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return grammar;
|
||||
}
|
||||
|
||||
function adaptToJavaScript(grammar, replacementScope) {
|
||||
grammar.name = 'JavaScript (with React support)';
|
||||
grammar.fileTypes = ['.js', '.jsx', '.es6', '.mjs' ];
|
||||
|
@ -33,10 +43,10 @@ function adaptToJavaScript(grammar, replacementScope) {
|
|||
}
|
||||
|
||||
var tsGrammarRepo = 'Microsoft/TypeScript-TmLanguage';
|
||||
updateGrammar.update(tsGrammarRepo, 'TypeScript.tmLanguage', './syntaxes/TypeScript.tmLanguage.json');
|
||||
updateGrammar.update(tsGrammarRepo, 'TypeScriptReact.tmLanguage', './syntaxes/TypeScriptReact.tmLanguage.json');
|
||||
updateGrammar.update(tsGrammarRepo, 'TypeScriptReact.tmLanguage', '../javascript/syntaxes/JavaScript.tmLanguage.json', grammar => adaptToJavaScript(grammar, '.js'));
|
||||
updateGrammar.update(tsGrammarRepo, 'TypeScriptReact.tmLanguage', '../javascript/syntaxes/JavaScriptReact.tmLanguage.json', grammar => adaptToJavaScript(grammar, '.js.jsx'));
|
||||
updateGrammar.update(tsGrammarRepo, 'TypeScript.tmLanguage', './syntaxes/TypeScript.tmLanguage.json', grammar => removeDom(grammar));
|
||||
updateGrammar.update(tsGrammarRepo, 'TypeScriptReact.tmLanguage', './syntaxes/TypeScriptReact.tmLanguage.json', grammar => removeDom(grammar));
|
||||
updateGrammar.update(tsGrammarRepo, 'TypeScriptReact.tmLanguage', '../javascript/syntaxes/JavaScript.tmLanguage.json', grammar => adaptToJavaScript(removeDom(grammar), '.js'));
|
||||
updateGrammar.update(tsGrammarRepo, 'TypeScriptReact.tmLanguage', '../javascript/syntaxes/JavaScriptReact.tmLanguage.json', grammar => adaptToJavaScript(removeDom(grammar), '.js.jsx'));
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -23,13 +23,13 @@
|
|||
},
|
||||
{
|
||||
"c": "push",
|
||||
"t": "source.ts meta.function-call.ts support.function.ts",
|
||||
"t": "source.ts meta.function-call.ts entity.name.function.ts",
|
||||
"r": {
|
||||
"dark_plus": "support.function: #DCDCAA",
|
||||
"light_plus": "support.function: #795E26",
|
||||
"dark_plus": "entity.name.function: #DCDCAA",
|
||||
"light_plus": "entity.name.function: #795E26",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "support.function: #DCDCAA"
|
||||
"hc_black": "entity.name.function: #DCDCAA"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -9153,13 +9153,13 @@
|
|||
},
|
||||
{
|
||||
"c": "push",
|
||||
"t": "source.ts meta.namespace.declaration.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.function-call.ts support.function.ts",
|
||||
"t": "source.ts meta.namespace.declaration.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.function-call.ts entity.name.function.ts",
|
||||
"r": {
|
||||
"dark_plus": "support.function: #DCDCAA",
|
||||
"light_plus": "support.function: #795E26",
|
||||
"dark_plus": "entity.name.function: #DCDCAA",
|
||||
"light_plus": "entity.name.function: #795E26",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "support.function: #DCDCAA"
|
||||
"hc_black": "entity.name.function: #DCDCAA"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -9406,13 +9406,13 @@
|
|||
},
|
||||
{
|
||||
"c": "push",
|
||||
"t": "source.ts meta.namespace.declaration.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.function-call.ts support.function.ts",
|
||||
"t": "source.ts meta.namespace.declaration.ts meta.block.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.function-call.ts entity.name.function.ts",
|
||||
"r": {
|
||||
"dark_plus": "support.function: #DCDCAA",
|
||||
"light_plus": "support.function: #795E26",
|
||||
"dark_plus": "entity.name.function: #DCDCAA",
|
||||
"light_plus": "entity.name.function: #795E26",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "support.function: #DCDCAA"
|
||||
"hc_black": "entity.name.function: #DCDCAA"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue