I'm making a VS Code extension for xml, but the if statements occurs highlighting bug. The code is below
<script><![CDATA[
if () {
}]]></script>
however, if (){
works normally
<script><![CDATA[
if (){
}]]></script>
even function statements too.
I tried modifying "if-statement", all of "end": "\}", "(?=\})" but failed to fix it
my tmlanguage expr is (source.scxml) and only fixed comment expr of source.js
{
"name": "source.js.embedded.scxml",
"begin": "(<!)(\\[)(CDATA\\[)",
"beginCaptures": {
"1": {"name": "punctuation.definition.tag.begin.scxml"},
"2": {"name": "punctuation.definition.tag.begin.scxml"},
"3": {"name": "entity.other.attribute-name.scxml"}
},
"end": "(\\])(\\])(>)",
"endCaptures": {
"1": {"name": "entity.other.attribute-name.scxml"},
"2": {"name": "punctuation.definition.tag.end.scxml"},
"3": {"name": "punctuation.definition.tag.end.scxml"}
},
"patterns": [
{
"include": "source.js"
}
]
}
additionally similar bug
<script><![CDATA[
//test]]></script>
highlighting error fixed at source.js
{
"name": "comment.block.js",
"begin": "(/\\*)(?:\\s*((@)internal)(?=\\s|(\\*/)))?",
"beginCaptures": {
"1": {
"name": "punctuation.definition.comment.js"
},
"2": {
"name": "storage.type.internaldeclaration.js"
},
"3": {
"name": "punctuation.decorator.internaldeclaration.js"
}
},
"end": "\\*/",
"endCaptures": {
"0": {
"name": "punctuation.definition.comment.js"
}
}
},
{
"begin": "(^[ \\t]+)?((//)(?:\\s*((@)internal)(?=\\s|$))?)",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.comment.leading.js"
},
"2": {
"name": "comment.line.double-slash.js"
},
"3": {
"name": "punctuation.definition.comment.js"
},
"4": {
"name": "storage.type.internaldeclaration.js"
},
"5": {
"name": "punctuation.decorator.internaldeclaration.js"
}
},
"end": "(?=$)",
"contentName": "comment.line.double-slash.js"
}
to
{
"name": "comment.block.js",
"begin": "(/\\*)(?:\\s*((@)internal)(?=\\s|(\\*/)))?",
"beginCaptures": {
"1": {
"name": "punctuation.definition.comment.js"
},
"2": {
"name": "storage.type.internaldeclaration.js"
},
"3": {
"name": "punctuation.decorator.internaldeclaration.js"
}
},
"end": "\\*/",
"endCaptures": {
"0": {
"name": "punctuation.definition.comment.js"
}
}
},
{
"begin": "(^[ \\t]+)?((//)(?:\\s*((@)internal)(?=\\s|$))?)",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.comment.leading.js"
},
"2": {
"name": "comment.line.double-slash.js"
},
"3": {
"name": "punctuation.definition.comment.js"
},
"4": {
"name": "storage.type.internaldeclaration.js"
},
"5": {
"name": "punctuation.decorator.internaldeclaration.js"
}
},
"end": "(?=\\]\\]>|$)",
"contentName": "comment.line.double-slash.js"
}