Skip to content

Commit a917218

Browse files
authored
Merge branch 'main' into tyriar/257822__share
2 parents 3953669 + b5eca89 commit a917218

23 files changed

+489
-131
lines changed

extensions/razor/build/update-grammar.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@ import * as vscodeGrammarUpdater from 'vscode-grammar-updater';
88

99
function patchGrammar(grammar) {
1010
grammar.scopeName = 'text.html.cshtml';
11+
12+
let patchCount = 0;
13+
14+
let visit = function (rule, parent) {
15+
if (rule.include?.startsWith('text.html.basic')) {
16+
patchCount++;
17+
rule.include = 'text.html.derivative';
18+
}
19+
for (let property in rule) {
20+
let value = rule[property ];
21+
if (typeof value === 'object') {
22+
visit(value, { node: rule, property: property, parent: parent });
23+
}
24+
}
25+
};
26+
27+
let roots = [grammar.repository, grammar.patterns];
28+
for (let root of roots) {
29+
for (let key in root) {
30+
visit(root[key], { node: root, property: key, parent: undefined });
31+
}
32+
}
33+
if (patchCount !== 4) {
34+
console.warn(`Expected to patch 4 occurrences of text.html.basic: Was ${patchCount}`);
35+
}
36+
1137
return grammar;
1238
}
1339

extensions/razor/syntaxes/cshtml.tmLanguage.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"include": "#razor-control-structures"
3535
},
3636
{
37-
"include": "text.html.basic"
37+
"include": "text.html.derivative"
3838
}
3939
],
4040
"repository": {
@@ -155,7 +155,7 @@
155155
"include": "#razor-control-structures"
156156
},
157157
{
158-
"include": "text.html.basic"
158+
"include": "text.html.derivative"
159159
}
160160
]
161161
}
@@ -239,7 +239,7 @@
239239
},
240240
"patterns": [
241241
{
242-
"include": "text.html.basic#attribute"
242+
"include": "text.html.derivative"
243243
}
244244
],
245245
"end": "/?>",
@@ -286,7 +286,7 @@
286286
"include": "#razor-control-structures"
287287
},
288288
{
289-
"include": "text.html.basic#attribute"
289+
"include": "text.html.derivative"
290290
}
291291
]
292292
},

0 commit comments

Comments
 (0)