mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
120aac9108
The TextMate grammars for inline templates and inline styles ended the
string at the first occurrence of the delimiter, so an escaped delimiter
(e.g. \`) terminated the highlighting prematurely and the rest of the
template was no longer highlighted as HTML.
Escape sequences are now consumed before delegating to the HTML/CSS
grammars, so escaped delimiters no longer end the string. Also removes
the stray pipes from the string delimiter character class, which
unintentionally matched a literal '|'.
Fixes #65493
(cherry picked from commit 1d9e445d1a)
81 lines
1.6 KiB
JSON
81 lines
1.6 KiB
JSON
{
|
|
"scopeName": "inline-template.ng",
|
|
"injectionSelector": "L:meta.decorator.ts -comment -text.html",
|
|
"patterns": [
|
|
{
|
|
"include": "#inlineTemplate"
|
|
}
|
|
],
|
|
"repository": {
|
|
"inlineTemplate": {
|
|
"begin": "(template)\\s*(:)",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "meta.object-literal.key.ts"
|
|
},
|
|
"2": {
|
|
"name": "meta.object-literal.key.ts punctuation.separator.key-value.ts"
|
|
}
|
|
},
|
|
"end": "(?=,|})",
|
|
"patterns": [
|
|
{
|
|
"include": "#tsParenExpression"
|
|
},
|
|
{
|
|
"include": "#ngTemplate"
|
|
}
|
|
]
|
|
},
|
|
"tsParenExpression": {
|
|
"begin": "\\G\\s*(\\()",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "meta.brace.round.ts"
|
|
}
|
|
},
|
|
"end": "\\)",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "meta.brace.round.ts"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#tsParenExpression"
|
|
},
|
|
{
|
|
"include": "#ngTemplate"
|
|
}
|
|
]
|
|
},
|
|
"ngTemplate": {
|
|
"begin": "\\G\\s*([`'\"])",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "string"
|
|
}
|
|
},
|
|
"end": "\\1",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "string"
|
|
}
|
|
},
|
|
"contentName": "text.html.derivative",
|
|
"patterns": [
|
|
{
|
|
"match": "\\\\[\\s\\S]",
|
|
"name": "constant.character.escape.ts"
|
|
},
|
|
{
|
|
"include": "text.html.derivative"
|
|
},
|
|
{
|
|
"include": "template.ng"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|