Skip to content

Commit 731ecef

Browse files
committed
Add syntax highlighting in fluent-vue custom block
1 parent b2f07bd commit 731ecef

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
"language": "ftl",
2121
"scopeName": "source.ftl",
2222
"path": "./syntaxes/ftl.tmLanguage.json"
23+
}, {
24+
"path": "./syntaxes/vue.injection.json",
25+
"scopeName": "meta.embedded.ftl",
26+
"injectTo": ["source.vue"],
27+
"embeddedLanguages": {
28+
"source.ftl": "ftl",
29+
"meta.embedded.block.ftl": "ftl"
30+
}
2331
}]
2432
}
2533
}

syntaxes/vue.injection.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"scopeName": "meta.embedded.ftl",
3+
"injectionSelector": "L:source.vue",
4+
"patterns": [
5+
{
6+
"begin": "(<)(fluent)\\b[^>]*(\\blocale\\s*=\\s*(['\"]?)\\w+\\b\\4)(>)",
7+
"beginCaptures": {
8+
"1": {
9+
"name": "punctuation.definition.tag.begin.html.vue"
10+
},
11+
"2": {
12+
"name": "entity.name.tag.fluent.html.vue"
13+
},
14+
"3": {
15+
"name": "meta.tag-stuff",
16+
"patterns": [
17+
{
18+
"include": "text.html.basic#attribute"
19+
}
20+
]
21+
},
22+
"5": {
23+
"name": "punctuation.definition.tag.end.html.vue"
24+
}
25+
},
26+
"end": "(<\/)((?i:fluent))(>)(?:\\s*\\n)?",
27+
"endCaptures": {
28+
"1": {
29+
"name": "punctuation.definition.tag.begin.html.vue"
30+
},
31+
"2": {
32+
"name": "entity.name.tag.fluent.html.vue"
33+
},
34+
"3": {
35+
"name": "punctuation.definition.tag.end.html.vue"
36+
}
37+
},
38+
"patterns": [
39+
{
40+
"begin": "^",
41+
"end": "(?=<\\/)",
42+
"name": "meta.embedded.block.ftl",
43+
"patterns": [
44+
{
45+
"include": "source.ftl"
46+
}
47+
]
48+
}
49+
]
50+
}
51+
]
52+
}

0 commit comments

Comments
 (0)