Skip to content

Commit 41db96d

Browse files
authored
fix: correctly specify embedded languages in an Angular template (#513)
Previously, HTML was not recognized as an embedded language in an inline template because the scope matching it (source.html) was never used in the inline template grammar. This commits fixes that and renames the embedded scope to the colloquial "text.html", as well as adding embedded language scopes for CSS and JavaScript. Attached to the PR for this commit is an animated GIF with a preview of the changes.
1 parent c33a49e commit 41db96d

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@
5656
"source.ts"
5757
],
5858
"embeddedLanguages": {
59-
"source.html": "html"
59+
"text.html": "html",
60+
"source.css": "css",
61+
"source.js": "javascript"
6062
}
6163
},
6264
{

syntaxes/inline-template.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"name": "string"
6565
}
6666
},
67+
"contentName": "text.html",
6768
"patterns": [
6869
{
6970
"include": "text.html.basic"

syntaxes/test/data/inline-template.ts.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# ^ inline-template.ng meta.object-literal.key.ts punctuation.separator.key-value.ts
1212
# ^ inline-template.ng
1313
# ^ inline-template.ng string
14-
# ^^^^^^^^^^^ inline-template.ng
14+
# ^^^^^^^^^^^ inline-template.ng text.html
1515
# ^ inline-template.ng string
1616
# ^^ inline-template.ng
1717
>
@@ -23,7 +23,7 @@
2323
# ^ inline-template.ng meta.object-literal.key.ts punctuation.separator.key-value.ts
2424
# ^ inline-template.ng
2525
# ^ inline-template.ng string
26-
# ^^^^^^^^^^^ inline-template.ng
26+
# ^^^^^^^^^^^ inline-template.ng text.html
2727
# ^ inline-template.ng string
2828
# ^^ inline-template.ng
2929
> template: "<div></div>",
@@ -32,7 +32,7 @@
3232
# ^ inline-template.ng meta.object-literal.key.ts punctuation.separator.key-value.ts
3333
# ^ inline-template.ng
3434
# ^ inline-template.ng string
35-
# ^^^^^^^^^^^ inline-template.ng
35+
# ^^^^^^^^^^^ inline-template.ng text.html
3636
# ^ inline-template.ng string
3737
# ^^ inline-template.ng
3838
> template: '<div></div>',
@@ -41,7 +41,7 @@
4141
# ^ inline-template.ng meta.object-literal.key.ts punctuation.separator.key-value.ts
4242
# ^ inline-template.ng
4343
# ^ inline-template.ng string
44-
# ^^^^^^^^^^^ inline-template.ng
44+
# ^^^^^^^^^^^ inline-template.ng text.html
4545
# ^ inline-template.ng string
4646
# ^^ inline-template.ng
4747
>
@@ -58,7 +58,7 @@
5858
# ^ inline-template.ng meta.brace.round.ts
5959
# ^ inline-template.ng
6060
# ^ inline-template.ng string
61-
# ^^^^^^^^^^^ inline-template.ng
61+
# ^^^^^^^^^^^ inline-template.ng text.html
6262
# ^ inline-template.ng string
6363
# ^ inline-template.ng
6464
# ^ inline-template.ng meta.brace.round.ts
@@ -75,7 +75,7 @@
7575
# ^ inline-template.ng meta.object-literal.key.ts punctuation.separator.key-value.ts
7676
# ^ inline-template.ng
7777
# ^ inline-template.ng string
78-
# ^^^^^^^^^^^ inline-template.ng
78+
# ^^^^^^^^^^^ inline-template.ng text.html
7979
# ^ inline-template.ng string
8080
> /*
8181
#^^^^^ inline-template.ng

0 commit comments

Comments
 (0)