Skip to content

Commit d30844c

Browse files
authored
feat(vue): update Vue grammar (#5)
* Update Vue language configuration * Remove unused vue-html.tmLanguage.json * Update vue.tmLanguage.json * Vue embedded languages: remove lang=md|pug|stylus support to limit requests
1 parent 0db892f commit d30844c

File tree

5 files changed

+1186
-2086
lines changed

5 files changed

+1186
-2086
lines changed

grammars/grammars.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,16 @@
294294
},
295295
{
296296
"language": "vue",
297-
"scopeName": "text.html.vue",
297+
"scopeName": "source.vue",
298298
"extensions": [".vue"],
299-
"grammar": "vue.tmLanguage",
299+
"grammar": {
300+
"base": "vue",
301+
"file": "vue.tmLanguage.json"
302+
},
303+
"configuration": {
304+
"base": "vue",
305+
"file": "language-configuration.json"
306+
},
300307
"embeddedLanguages": {
301308
"text.pug.embedded": "jade",
302309
"text.slm.embedded": "slm",

grammars/vue/language-configuration.json

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,54 @@
1414
{ "open": "(", "close": ")" },
1515
{ "open": "'", "close": "'" },
1616
{ "open": "\"", "close": "\"" },
17-
{ "open": "<!--", "close": "-->", "notIn": ["comment", "string"] }
17+
{ "open": "<!--", "close": "-->", "notIn": ["comment", "string"] },
18+
{ "open": "`", "close": "`", "notIn": ["string", "comment"] },
19+
{ "open": "/**", "close": " */", "notIn": ["string"] }
1820
],
21+
"autoCloseBefore": ";:.,=}])><`'\" \n\t",
1922
"surroundingPairs": [
2023
{ "open": "'", "close": "'" },
2124
{ "open": "\"", "close": "\"" },
2225
{ "open": "{", "close": "}" },
2326
{ "open": "[", "close": "]" },
2427
{ "open": "(", "close": ")" },
25-
{ "open": "<", "close": ">" }
28+
{ "open": "<", "close": ">" },
29+
["`", "`"]
2630
],
31+
"colorizedBracketPairs": [],
2732
"folding": {
2833
"markers": {
2934
"start": "^\\s*<!--\\s*#region\\b.*-->",
3035
"end": "^\\s*<!--\\s*#endregion\\b.*-->"
3136
}
37+
},
38+
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\$\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\s]+)",
39+
"onEnterRules": [
40+
{
41+
"beforeText": {
42+
"pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr|script|style))([_:\\w][_:\\w-.\\d]*)(?:(?:[^'\"/>]|\"[^\"]*\"|'[^']*')*?(?!\\/)>)[^<]*$",
43+
"flags": "i"
44+
},
45+
"afterText": {
46+
"pattern": "^<\\/([_:\\w][_:\\w-.\\d]*)\\s*>",
47+
"flags": "i"
48+
},
49+
"action": {
50+
"indent": "indentOutdent"
51+
}
52+
},
53+
{
54+
"beforeText": {
55+
"pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr|script|style))([_:\\w][_:\\w-.\\d]*)(?:(?:[^'\"/>]|\"[^\"]*\"|'[^']*')*?(?!\\/)>)[^<]*$",
56+
"flags": "i"
57+
},
58+
"action": {
59+
"indent": "indent"
60+
}
61+
}
62+
],
63+
"indentationRules": {
64+
"increaseIndentPattern": "<(?!\\?|(?:area|base|br|col|frame|hr|html|img|input|keygen|link|menuitem|meta|param|source|track|wbr|script|style)\\b|[^>]*\\/>)([-_\\.A-Za-z0-9]+)(?=\\s|>)\\b[^>]*>(?!\\s*\\()(?!.*<\\/\\1>)|<!--(?!.*-->)|\\{[^}\"']*$",
65+
"decreaseIndentPattern": "^\\s*(<\\/(?!html)[-_\\.A-Za-z0-9]+\\b[^>]*>|-->|\\})"
3266
}
3367
}

0 commit comments

Comments
 (0)