From 13637a83e9624ff114b785e49fc6ab172129f3cf Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 5 Sep 2025 18:45:27 +0200 Subject: [PATCH 1/4] ci: run on macos-latest --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1faa8af..22e0b67 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-14] + os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Set up repository uses: actions/checkout@v4 From d8e829c2d872401db496fd1dd7fff8a337678403 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 5 Sep 2025 18:29:47 +0200 Subject: [PATCH 2/4] ci: validate queries with ts_query_ls --- .github/workflows/ci.yaml | 21 +++++++++++++++++++++ .tsqueryrc.json | 4 ++++ queries/query/highlights.scm | 22 ++++++++++------------ queries/query/injections.scm | 19 ++++++++----------- 4 files changed, 43 insertions(+), 23 deletions(-) create mode 100644 .tsqueryrc.json diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 22e0b67..5604999 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -43,3 +43,24 @@ jobs: uses: tree-sitter/parse-action@v4 with: files: .tests/nvim-treesitter/runtime/queries/*/*.scm + + query: + name: Validate queries + runs-on: ubuntu-latest + steps: + - name: Set up repository + uses: actions/checkout@v4 + + - name: Set up tree-sitter + uses: tree-sitter/setup-action@v2 + with: + install-lib: false + + - name: Build parser + run: tree-sitter build + + - name: Set up ts_query_ls + run: curl -fL https://github.com/ribru17/ts_query_ls/releases/latest/download/ts_query_ls-x86_64-unknown-linux-gnu.tar.gz | tar -xz + + - name: Check queries + run: ./ts_query_ls check -f queries/ diff --git a/.tsqueryrc.json b/.tsqueryrc.json new file mode 100644 index 0000000..3619c9b --- /dev/null +++ b/.tsqueryrc.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://raw.githubusercontent.com/ribru17/ts_query_ls/refs/heads/master/schemas/config.json", + "parser_install_directories": ["."] +} diff --git a/queries/query/highlights.scm b/queries/query/highlights.scm index d909df1..639f839 100644 --- a/queries/query/highlights.scm +++ b/queries/query/highlights.scm @@ -68,20 +68,18 @@ ((predicate name: (identifier) @_name - parameters: - (parameters - (string - "\"" @string - "\"" @string) @string.regexp)) + parameters: (parameters + (string + "\"" @string + "\"" @string) @string.regexp)) (#any-of? @_name "match" "not-match" "vim-match" "not-vim-match" "lua-match" "not-lua-match")) ((predicate name: (identifier) @_name - parameters: - (parameters - (string - "\"" @string - "\"" @string) @string.regexp - . - (string) .)) + parameters: (parameters + (string + "\"" @string + "\"" @string) @string.regexp + . + (string) .)) (#any-of? @_name "gsub" "not-gsub")) diff --git a/queries/query/injections.scm b/queries/query/injections.scm index dd1a855..408d88e 100644 --- a/queries/query/injections.scm +++ b/queries/query/injections.scm @@ -1,28 +1,25 @@ ((predicate name: (identifier) @_name - parameters: - (parameters - (string) @injection.content)) + parameters: (parameters + (string) @injection.content)) (#any-of? @_name "match" "not-match" "vim-match" "not-vim-match") (#set! injection.language "regex") (#offset! @injection.content 0 1 0 -1)) ((predicate name: (identifier) @_name - parameters: - (parameters - (string) @injection.content)) + parameters: (parameters + (string) @injection.content)) (#any-of? @_name "lua-match" "not-lua-match") (#set! injection.language "luap") (#offset! @injection.content 0 1 0 -1)) ((predicate name: (identifier) @_name - parameters: - (parameters - (string) @injection.content - . - (string) .)) + parameters: (parameters + (string) @injection.content + . + (string) .)) (#any-of? @_name "gsub" "not-gsub") (#set! injection.language "luap") (#offset! @injection.content 0 1 0 -1)) From e12ef7de6233baf305fbec1cbbba28cafb5b60e2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 5 Sep 2025 18:40:12 +0200 Subject: [PATCH 3/4] chore: update queries from nvim-treesitter --- queries/query/highlights.scm | 35 ++++++++++++++++++++++++++--------- queries/query/injections.scm | 22 +++++++++++----------- test/highlight/statements.scm | 6 +++--- 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/queries/query/highlights.scm b/queries/query/highlights.scm index 639f839..cbd192a 100644 --- a/queries/query/highlights.scm +++ b/queries/query/highlights.scm @@ -5,17 +5,17 @@ (capture (identifier) @type) -(anonymous_node - (string) @string) - (predicate name: (identifier) @function.call) (named_node name: (identifier) @variable) +(missing_node + name: (identifier) @variable) + (field_definition - name: (identifier) @property) + name: (identifier) @variable.member) (negated_field "!" @operator @@ -36,14 +36,22 @@ ")" ] @punctuation.bracket -":" @punctuation.delimiter +[ + ":" + "/" +] @punctuation.delimiter [ "@" "#" ] @punctuation.special -"_" @constant +(predicate + "." @punctuation.special) + +"_" @character.special + +"MISSING" @keyword ((parameters (identifier) @number) @@ -53,19 +61,28 @@ . (comment)* . - (comment) @keyword.import) + (comment) @keyword.import @nospell) (#lua-match? @keyword.import "^;+ *inherits *:")) ((program . (comment)* . - (comment) @keyword.directive) + (comment) @keyword.directive @nospell) (#lua-match? @keyword.directive "^;+ *extends *$")) -((comment) @keyword.directive +((comment) @keyword.directive @nospell (#lua-match? @keyword.directive "^;+%s*format%-ignore%s*$")) +((predicate + name: (identifier) @_name + parameters: (parameters + . + (capture)? + . + (identifier) @property)) + (#eq? @_name "set")) + ((predicate name: (identifier) @_name parameters: (parameters diff --git a/queries/query/injections.scm b/queries/query/injections.scm index 408d88e..759f9b2 100644 --- a/queries/query/injections.scm +++ b/queries/query/injections.scm @@ -1,28 +1,28 @@ ((predicate name: (identifier) @_name parameters: (parameters - (string) @injection.content)) - (#any-of? @_name "match" "not-match" "vim-match" "not-vim-match") - (#set! injection.language "regex") - (#offset! @injection.content 0 1 0 -1)) + (string + (string_content) @injection.content))) + (#any-of? @_name "match" "not-match" "any-match" "vim-match" "not-vim-match" "any-vim-match") + (#set! injection.language "regex")) ((predicate name: (identifier) @_name parameters: (parameters - (string) @injection.content)) - (#any-of? @_name "lua-match" "not-lua-match") - (#set! injection.language "luap") - (#offset! @injection.content 0 1 0 -1)) + (string + (string_content) @injection.content))) + (#any-of? @_name "lua-match" "not-lua-match" "any-lua-match") + (#set! injection.language "luap")) ((predicate name: (identifier) @_name parameters: (parameters - (string) @injection.content + (string + (string_content) @injection.content) . (string) .)) (#any-of? @_name "gsub" "not-gsub") - (#set! injection.language "luap") - (#offset! @injection.content 0 1 0 -1)) + (#set! injection.language "luap")) ((comment) @injection.content (#set! injection.language "comment")) diff --git a/test/highlight/statements.scm b/test/highlight/statements.scm index fd3239a..a6851b3 100644 --- a/test/highlight/statements.scm +++ b/test/highlight/statements.scm @@ -11,16 +11,16 @@ ; ^ @type name: (identifier) -; <- @property +; <- @variable.member ; ^ @punctuation.delimiter (program name: (_)) -; ^ @constant +; ^ @character.special (program name: _) -; ^ @constant +; ^ @character.special (program field: (identifier) @capture From 4499a761188aad81a692cdf6f8e5ca0601db7dc8 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 7 Sep 2025 00:02:46 +0200 Subject: [PATCH 4/4] chore: tree-sitter 0.25.9 --- src/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser.c b/src/parser.c index 151fe55..45bce09 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1,4 +1,4 @@ -/* Automatically @generated by tree-sitter v0.25.8 */ +/* Automatically @generated by tree-sitter v0.25.9 */ #include "tree_sitter/parser.h"