fix matching bracket highlighting in js templates

smf-sdk
nightwing 2015-12-29 14:34:21 +04:00
rodzic 687d5838b2
commit f5fe64d1f2
3 zmienionych plików z 47 dodań i 3 usunięć

Wyświetl plik

@ -93,3 +93,8 @@ z=<div {...this.props} x={1 + 2} y="z{a}b&amp;" t={
1 <a> { ++x } </a>
</div>
var o = {
t:`${[].map(x => {
return x
})}`
};

Wyświetl plik

@ -686,5 +686,45 @@
],[
"start"
],[
"start"
"start",
["storage.type","var"],
["text"," "],
["identifier","o"],
["text"," "],
["keyword.operator","="],
["text"," "],
["paren.lparen","{"]
],[
["start","no_regex","start","string.quasi.start","string.quasi.start","no_regex"],
["text"," "],
["identifier","t"],
["punctuation.operator",":"],
["string.quasi.start","`"],
["paren.quasi.start","${"],
["paren.lparen","["],
["paren.rparen","]"],
["punctuation.operator","."],
["identifier","map"],
["paren.lparen","("],
["identifier","x"],
["text"," "],
["keyword.operator","=>"],
["text"," "],
["paren.lparen","{"]
],[
["#tmp","no_regex","start","no_regex","start","string.quasi.start","string.quasi.start","no_regex"],
["text"," "],
["keyword","return"],
["text"," "],
["identifier","x"]
],[
"no_regex",
["text"," "],
["paren.rparen","})"],
["paren.quasi.end","}"],
["string.quasi.end","`"]
],[
"start",
["paren.rparen","}"],
["punctuation.operator",";"]
]]

Wyświetl plik

@ -354,9 +354,8 @@ var JavaScriptHighlightRules = function(options) {
this.next = val == "{" ? this.nextState : "";
if (val == "{" && stack.length) {
stack.unshift("start", state);
return "paren";
}
if (val == "}" && stack.length) {
else if (val == "}" && stack.length) {
stack.shift();
this.next = stack.shift();
if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)