From 93e54fa0c88dc0c8761242b14b11a5aca79c6faf Mon Sep 17 00:00:00 2001 From: DS/Charlie Date: Sat, 7 Oct 2023 00:29:42 +0200 Subject: add support for json5 (#8473) * add json5 language * docgen--- book/src/generated/lang-support.md | 1 + languages.toml | 16 ++++++++++++++++ runtime/queries/json5/highlights.scm | 11 +++++++++++ 3 files changed, 28 insertions(+) create mode 100644 runtime/queries/json5/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index f65f268d..378c6730 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -76,6 +76,7 @@ | jinja | ✓ | | | | | jsdoc | ✓ | | | | | json | ✓ | | ✓ | `vscode-json-language-server` | +| json5 | ✓ | | | | | jsonnet | ✓ | | | `jsonnet-language-server` | | jsx | ✓ | ✓ | ✓ | `typescript-language-server` | | julia | ✓ | ✓ | ✓ | `julia` | diff --git a/languages.toml b/languages.toml index 8fafd5d4..6eab0421 100644 --- a/languages.toml +++ b/languages.toml @@ -348,6 +348,22 @@ indent = { tab-width = 2, unit = " " } name = "json" source = { git = "https://github.com/tree-sitter/tree-sitter-json", rev = "73076754005a460947cafe8e03a8cf5fa4fa2938" } + +[[language]] +name = "json5" +scope = "source.json5" +injection-regex = "json5" +file-types = ["json5"] +roots = [] +language-servers = [] +comment-token = "//" +indent = { tab-width = 4, unit = " " } +# https://json5.org + +[[grammar]] +name = "json5" +source = { git = "https://github.com/Joakker/tree-sitter-json5", rev = "c23f7a9b1ee7d45f516496b1e0e4be067264fa0d" } + [[language]] name = "c" scope = "source.c" diff --git a/runtime/queries/json5/highlights.scm b/runtime/queries/json5/highlights.scm new file mode 100644 index 00000000..4bf03fe3 --- /dev/null +++ b/runtime/queries/json5/highlights.scm @@ -0,0 +1,11 @@ +(string) @string + +(identifier) @constant + +(number) @constant.numeric + +(null) @constant.builtin + +[(true) (false)] @constant.builtin.boolean + +(comment) @comment -- cgit v1.2.3-70-g09d2