Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml12
-rw-r--r--runtime/queries/json-ld/highlights.scm43
-rw-r--r--runtime/queries/json-ld/indents.scm1
-rw-r--r--runtime/queries/json-ld/textobjects.scm1
5 files changed, 57 insertions, 1 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 907dd318..1544c768 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -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` |
diff --git a/languages.toml b/languages.toml
index 8b1c4bc0..b5d9c81a 100644
--- a/languages.toml
+++ b/languages.toml
@@ -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"
diff --git a/runtime/queries/json-ld/highlights.scm b/runtime/queries/json-ld/highlights.scm
new file mode 100644
index 00000000..8fccb10a
--- /dev/null
+++ b/runtime/queries/json-ld/highlights.scm
@@ -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"))
diff --git a/runtime/queries/json-ld/indents.scm b/runtime/queries/json-ld/indents.scm
new file mode 100644
index 00000000..41269219
--- /dev/null
+++ b/runtime/queries/json-ld/indents.scm
@@ -0,0 +1 @@
+; inherits: json
diff --git a/runtime/queries/json-ld/textobjects.scm b/runtime/queries/json-ld/textobjects.scm
new file mode 100644
index 00000000..41269219
--- /dev/null
+++ b/runtime/queries/json-ld/textobjects.scm
@@ -0,0 +1 @@
+; inherits: json