Skip to content

Commit

Permalink
feat(vue): update Vue grammar (#5)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
fvsch authored Nov 30, 2023
1 parent 0db892f commit d30844c
Show file tree
Hide file tree
Showing 5 changed files with 1,186 additions and 2,086 deletions.
11 changes: 9 additions & 2 deletions grammars/grammars.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,16 @@
},
{
"language": "vue",
"scopeName": "text.html.vue",
"scopeName": "source.vue",
"extensions": [".vue"],
"grammar": "vue.tmLanguage",
"grammar": {
"base": "vue",
"file": "vue.tmLanguage.json"
},
"configuration": {
"base": "vue",
"file": "language-configuration.json"
},
"embeddedLanguages": {
"text.pug.embedded": "jade",
"text.slm.embedded": "slm",
Expand Down
38 changes: 36 additions & 2 deletions grammars/vue/language-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,54 @@
{ "open": "(", "close": ")" },
{ "open": "'", "close": "'" },
{ "open": "\"", "close": "\"" },
{ "open": "<!--", "close": "-->", "notIn": ["comment", "string"] }
{ "open": "<!--", "close": "-->", "notIn": ["comment", "string"] },
{ "open": "`", "close": "`", "notIn": ["string", "comment"] },
{ "open": "/**", "close": " */", "notIn": ["string"] }
],
"autoCloseBefore": ";:.,=}])><`'\" \n\t",
"surroundingPairs": [
{ "open": "'", "close": "'" },
{ "open": "\"", "close": "\"" },
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "<", "close": ">" }
{ "open": "<", "close": ">" },
["`", "`"]
],
"colorizedBracketPairs": [],
"folding": {
"markers": {
"start": "^\\s*<!--\\s*#region\\b.*-->",
"end": "^\\s*<!--\\s*#endregion\\b.*-->"
}
},
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\$\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\s]+)",
"onEnterRules": [
{
"beforeText": {
"pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr|script|style))([_:\\w][_:\\w-.\\d]*)(?:(?:[^'\"/>]|\"[^\"]*\"|'[^']*')*?(?!\\/)>)[^<]*$",
"flags": "i"
},
"afterText": {
"pattern": "^<\\/([_:\\w][_:\\w-.\\d]*)\\s*>",
"flags": "i"
},
"action": {
"indent": "indentOutdent"
}
},
{
"beforeText": {
"pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr|script|style))([_:\\w][_:\\w-.\\d]*)(?:(?:[^'\"/>]|\"[^\"]*\"|'[^']*')*?(?!\\/)>)[^<]*$",
"flags": "i"
},
"action": {
"indent": "indent"
}
}
],
"indentationRules": {
"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>)|<!--(?!.*-->)|\\{[^}\"']*$",
"decreaseIndentPattern": "^\\s*(<\\/(?!html)[-_\\.A-Za-z0-9]+\\b[^>]*>|-->|\\})"
}
}
Loading

0 comments on commit d30844c

Please sign in to comment.