Add Support for JSONC (#9906)

* Added `jsonc` language with support for comments

The `vscode-json-language-server` accepts `jsonc` as a language id.
Allowing the use of comments within JSON files.

* fix: Update `injdection-rejex` to be unique

* fix: use includes to remove redundant queries

* ci: Generate language-support docs
This commit is contained in:
George "Riye" Hollister 2024-03-17 22:54:05 +00:00 committed by GitHub
parent 9ec0271873
commit e36774c2c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 1 deletions

View file

@ -88,6 +88,7 @@
| jsdoc | ✓ | | | | | jsdoc | ✓ | | | |
| json | ✓ | | ✓ | `vscode-json-language-server` | | json | ✓ | | ✓ | `vscode-json-language-server` |
| json5 | ✓ | | | | | json5 | ✓ | | | |
| jsonc | ✓ | | ✓ | `vscode-json-language-server` |
| jsonnet | ✓ | | | `jsonnet-language-server` | | jsonnet | ✓ | | | `jsonnet-language-server` |
| jsx | ✓ | ✓ | ✓ | `typescript-language-server` | | jsx | ✓ | ✓ | ✓ | `typescript-language-server` |
| julia | ✓ | ✓ | ✓ | `julia` | | julia | ✓ | ✓ | ✓ | `julia` |

View file

@ -367,7 +367,6 @@ scope = "source.json"
injection-regex = "json" injection-regex = "json"
file-types = [ file-types = [
"json", "json",
"jsonc",
"arb", "arb",
"ipynb", "ipynb",
"geojson", "geojson",
@ -396,6 +395,15 @@ indent = { tab-width = 2, unit = " " }
name = "json" name = "json"
source = { git = "https://github.com/tree-sitter/tree-sitter-json", rev = "73076754005a460947cafe8e03a8cf5fa4fa2938" } source = { git = "https://github.com/tree-sitter/tree-sitter-json", rev = "73076754005a460947cafe8e03a8cf5fa4fa2938" }
[[language]]
name = "jsonc"
scope = "source.json"
injection-regex = "jsonc"
file-types = ["jsonc"]
grammar = "json"
language-servers = [ "vscode-json-language-server" ]
auto-format = true
indent = { tab-width = 2, unit = " " }
[[language]] [[language]]
name = "json5" name = "json5"

View file

@ -0,0 +1,2 @@
; inherits: json
(comment) @comment

View file

@ -0,0 +1 @@
; inherits: json