From d5e87dde100a5a3377043fc55846c97b03b6b01f Mon Sep 17 00:00:00 2001 From: kghugo Date: Sat, 18 Sep 2021 21:15:37 +0100 Subject: Support hjson --- ftdetect/hjson.vim | 1 + lua/nvim-treesitter/parsers.lua | 9 +++++++++ queries/hjson/folds.scm | 1 + queries/hjson/highlights.scm | 16 ++++++++++++++++ queries/hjson/indents.scm | 3 +++ queries/hjson/injections.scm | 1 + queries/hjson/locals.scm | 1 + 7 files changed, 32 insertions(+) create mode 100644 ftdetect/hjson.vim create mode 100644 queries/hjson/folds.scm create mode 100644 queries/hjson/highlights.scm create mode 100644 queries/hjson/indents.scm create mode 100644 queries/hjson/injections.scm create mode 100644 queries/hjson/locals.scm diff --git a/ftdetect/hjson.vim b/ftdetect/hjson.vim new file mode 100644 index 000000000..65ed94625 --- /dev/null +++ b/ftdetect/hjson.vim @@ -0,0 +1 @@ +autocmd BufNewFile,BufRead *.hjson set filetype=hjson diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 9ad17fec4..f526fbb1d 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -720,6 +720,15 @@ list.pioasm = { maintainers = { "@leo60228" }, } +list.hjson = { + install_info = { + url = "https://github.com/winston0410/tree-sitter-hjson", + files = { "src/parser.c" }, + generate_requires_npm = true, + }, + maintainers = { "@winston0410" }, +} + local M = { list = list, } diff --git a/queries/hjson/folds.scm b/queries/hjson/folds.scm new file mode 100644 index 000000000..41269219e --- /dev/null +++ b/queries/hjson/folds.scm @@ -0,0 +1 @@ +; inherits: json diff --git a/queries/hjson/highlights.scm b/queries/hjson/highlights.scm new file mode 100644 index 000000000..c8eed139f --- /dev/null +++ b/queries/hjson/highlights.scm @@ -0,0 +1,16 @@ +(true) @boolean +(false) @boolean +(null) @constant.builtin +(number) @number +(pair key: (string) @label) +(pair value: (string) @string) +(array (string) @string) +; (string_content (escape_sequence) @string.escape) +(ERROR) @error +; "," @punctuation.delimiter +"[" @punctuation.bracket +"]" @punctuation.bracket +"{" @punctuation.bracket +"}" @punctuation.bracket + +(comment) @comment diff --git a/queries/hjson/indents.scm b/queries/hjson/indents.scm new file mode 100644 index 000000000..26a42eeda --- /dev/null +++ b/queries/hjson/indents.scm @@ -0,0 +1,3 @@ +; inherits: json + +(comment) @ignore diff --git a/queries/hjson/injections.scm b/queries/hjson/injections.scm new file mode 100644 index 000000000..4bb7d675d --- /dev/null +++ b/queries/hjson/injections.scm @@ -0,0 +1 @@ +(comment) @comment diff --git a/queries/hjson/locals.scm b/queries/hjson/locals.scm new file mode 100644 index 000000000..41269219e --- /dev/null +++ b/queries/hjson/locals.scm @@ -0,0 +1 @@ +; inherits: json -- cgit v1.2.3-70-g09d2