mirror of https://github.com/helix-editor/helix
languages: create dedicated language for json-ld (#13925)
parent
16d06643a4
commit
8e0f326ebb
|
@ -120,6 +120,7 @@
|
|||
| jq | ✓ | ✓ | | `jq-lsp` |
|
||||
| jsdoc | ✓ | | | |
|
||||
| json | ✓ | ✓ | ✓ | `vscode-json-language-server` |
|
||||
| json-ld | ✓ | ✓ | ✓ | `vscode-json-language-server` |
|
||||
| json5 | ✓ | | | |
|
||||
| jsonc | ✓ | | ✓ | `vscode-json-language-server` |
|
||||
| jsonnet | ✓ | | | `jsonnet-language-server` |
|
||||
|
|
|
@ -514,7 +514,6 @@ file-types = [
|
|||
"css.map",
|
||||
{ glob = ".jslintrc" },
|
||||
"jsonl",
|
||||
"jsonld",
|
||||
{ glob = ".vuerc" },
|
||||
{ glob = "composer.lock" },
|
||||
{ glob = ".watchmanconfig" },
|
||||
|
@ -555,6 +554,17 @@ language-servers = [ "vscode-json-language-server" ]
|
|||
auto-format = true
|
||||
indent = { tab-width = 2, unit = " " }
|
||||
|
||||
# https://www.w3.org/TR/json-ld/
|
||||
[[language]]
|
||||
name = "json-ld"
|
||||
scope = "source.json-ld"
|
||||
injection-regex = "json-ld"
|
||||
grammar = "json"
|
||||
file-types = ["jsonld"]
|
||||
language-servers = ["vscode-json-language-server"]
|
||||
auto-format = true
|
||||
indent = { tab-width = 2, unit = " " }
|
||||
|
||||
[[language]]
|
||||
name = "json5"
|
||||
scope = "source.json5"
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
; inherits: json
|
||||
|
||||
; https://www.w3.org/TR/json-ld/#syntax-tokens-and-keywords
|
||||
((string (string_content) @keyword)
|
||||
(#any-of? @keyword
|
||||
"@base"
|
||||
"@container"
|
||||
"@context"
|
||||
"@direction"
|
||||
"@graph"
|
||||
"@id"
|
||||
"@import"
|
||||
"@included"
|
||||
"@index"
|
||||
"@json"
|
||||
"@language"
|
||||
"@list"
|
||||
"@nest"
|
||||
"@none"
|
||||
"@prefix"
|
||||
"@propagate"
|
||||
"@protected"
|
||||
"@reverse"
|
||||
"@set"
|
||||
"@type"
|
||||
"@value"
|
||||
"@version"
|
||||
"@vocab"))
|
||||
|
||||
((pair
|
||||
value: (string (string_content) @string.special.url))
|
||||
(#match? @string.special.url "^https?://"))
|
||||
|
||||
((array
|
||||
(string (string_content) @string.special.url))
|
||||
(#match? @string.special.url "^https?://"))
|
||||
|
||||
; https://www.w3.org/TR/json-ld/#dfn-base-direction
|
||||
((pair
|
||||
key: (string (string_content) @keyword)
|
||||
value: (string (string_content) @type.enum.variant))
|
||||
(#eq? @keyword "@direction")
|
||||
(#any-of? @type.enum.variant "ltr" "rtl"))
|
|
@ -0,0 +1 @@
|
|||
; inherits: json
|
|
@ -0,0 +1 @@
|
|||
; inherits: json
|
Loading…
Reference in New Issue