Skip to content

Commit

Permalink
feat: support syntax highlighting for lang="json5" (#2244)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sight-wcg committed Dec 21, 2022
1 parent ef417e3 commit 97c870b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions extensions/vscode-vue-language-features/package.json
Expand Up @@ -182,6 +182,7 @@
"meta.tag.without-attributes.tsx": "jsx-tags",
"source.json": "json",
"source.json.comments": "jsonc",
"source.json5": "json5",
"source.yaml": "yaml",
"source.toml": "toml",
"source.graphql": "graphql"
Expand Down Expand Up @@ -224,6 +225,7 @@
"meta.tag.without-attributes.tsx": "jsx-tags",
"source.json": "json",
"source.json.comments": "jsonc",
"source.json5": "json5",
"source.yaml": "yaml",
"source.toml": "toml",
"source.graphql": "graphql"
Expand Down Expand Up @@ -467,6 +469,10 @@
"jsonc": {
"type": "boolean",
"default": false
},
"json5": {
"type": "boolean",
"default": false
}
}
},
Expand Down
Expand Up @@ -503,6 +503,38 @@
}
]
},
{
"begin": "([a-zA-Z0-9:-]+)\\b(?=[^>]*\\blang\\s*=\\s*(['\"]?)json5\\b\\2)",
"beginCaptures": {
"1": {
"name": "entity.name.tag.$1.html.vue"
}
},
"end": "(</)(\\1)\\s*(?=>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html.vue"
},
"2": {
"name": "entity.name.tag.$2.html.vue"
}
},
"patterns": [
{
"include": "#tag-stuff"
},
{
"begin": "(?<=>)",
"end": "(?=<\\/)",
"name": "source.json5",
"patterns": [
{
"include": "source.json5"
}
]
}
]
},
{
"begin": "([a-zA-Z0-9:-]+)\\b(?=[^>]*\\blang\\s*=\\s*(['\"]?)yaml\\b\\2)",
"beginCaptures": {
Expand Down
1 change: 1 addition & 0 deletions vue-language-tools/vue-language-service/src/plugins/vue.ts
Expand Up @@ -101,6 +101,7 @@ const dataProvider: html.IHTMLDataProvider = {
{ name: 'md' },
{ name: 'json' },
{ name: 'jsonc' },
{ name: 'json5' },
{ name: 'yaml' },
{ name: 'toml' },
{ name: 'gql' },
Expand Down

0 comments on commit 97c870b

Please sign in to comment.