feat(treesitter): bundle query parser and queries (#22483)

skip injections for now
This commit is contained in:
Christian Clason
2023-03-03 14:27:30 +01:00
committed by GitHub
parent 74c9c413e7
commit 98e051783c
6 changed files with 50 additions and 6 deletions

View File

@ -11,10 +11,10 @@
arguments: (arguments (string content: _ @vim)))
(#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec" "vim.api.nvim_cmd"))
; ((function_call
; name: (_) @_vimcmd_identifier
; arguments: (arguments (string content: _ @query) .))
; (#eq? @_vimcmd_identifier "vim.treesitter.query.set_query"))
((function_call
name: (_) @_vimcmd_identifier
arguments: (arguments (string content: _ @query) .))
(#eq? @_vimcmd_identifier "vim.treesitter.query.set_query"))
; ;; highlight string as query if starts with `;; query`
; ((string ("string_content") @query) (#lua-match? @query "^%s*;+%s?query"))

View File

@ -0,0 +1,6 @@
[
(named_node)
(predicate)
(grouping)
(list)
] @fold

View File

@ -0,0 +1,34 @@
(string) @string
(escape_sequence) @string.escape
(capture (identifier) @type)
(anonymous_node (identifier) @string)
(predicate name: (identifier) @function)
(named_node name: (identifier) @variable)
(field_definition name: (identifier) @property)
(negated_field "!" @operator (identifier) @property)
(comment) @comment @spell
(quantifier) @operator
(predicate_type) @punctuation.special
"." @operator
[
"["
"]"
"("
")"
] @punctuation.bracket
":" @punctuation.delimiter
["@" "#"] @punctuation.special
"_" @constant
((parameters (identifier) @number)
(#match? @number "^[-+]?[0-9]+(.[0-9]+)?$"))
((program . (comment) @include)
(#match? @include "^;\ +inherits\ *:"))
((program . (comment) @preproc)
(#match? @preproc "^; +extends"))

View File

@ -24,5 +24,5 @@
"patchexpr" "pex"
"charconvert" "ccv"))
(comment) @comment
(line_continuation_comment) @comment
; (comment) @comment
; (line_continuation_comment) @comment