mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 10:50:06 -04:00
chore: query formatting
This commit is contained in:
parent
79975d6557
commit
57a8acf0c4
674 changed files with 18466 additions and 12648 deletions
|
|
@ -1,66 +1,54 @@
|
|||
; Tags
|
||||
|
||||
; TODO apply to every symbol in list? I think it should probably only be applied to the first child of the list
|
||||
(list
|
||||
(symbol) @tag)
|
||||
|
||||
; Includes
|
||||
|
||||
(list .
|
||||
(list
|
||||
.
|
||||
((symbol) @keyword.import
|
||||
(#eq? @keyword.import "include")))
|
||||
|
||||
; Keywords
|
||||
|
||||
; I think there's a bug in tree-sitter the anchor doesn't seem to be working, see
|
||||
; https://github.com/tree-sitter/tree-sitter/pull/2107
|
||||
(list .
|
||||
(list
|
||||
.
|
||||
((symbol) @keyword
|
||||
(#any-of? @keyword "defwindow" "defwidget" "defvar" "defpoll" "deflisten" "geometry" "children" "struts")))
|
||||
|
||||
; Loop
|
||||
(loop_widget
|
||||
.
|
||||
"for" @keyword.repeat
|
||||
.
|
||||
(symbol) @variable
|
||||
.
|
||||
"in" @keyword.operator)
|
||||
|
||||
(loop_widget . "for" @keyword.repeat . (symbol) @variable . "in" @keyword.operator)
|
||||
|
||||
(loop_widget . "for" @keyword.repeat . (symbol) @variable . "in" @keyword.operator . (symbol) @variable)
|
||||
(loop_widget
|
||||
.
|
||||
"for" @keyword.repeat
|
||||
.
|
||||
(symbol) @variable
|
||||
.
|
||||
"in" @keyword.operator
|
||||
.
|
||||
(symbol) @variable)
|
||||
|
||||
; Builtin widgets
|
||||
|
||||
(list .
|
||||
(list
|
||||
.
|
||||
((symbol) @tag.builtin
|
||||
(#any-of? @tag.builtin
|
||||
"box"
|
||||
"button"
|
||||
"calendar"
|
||||
"centerbox"
|
||||
"checkbox"
|
||||
"circular-progress"
|
||||
"color-button"
|
||||
"color-chooser"
|
||||
"combo-box-text"
|
||||
"eventbox"
|
||||
"expander"
|
||||
"graph"
|
||||
"image"
|
||||
"input"
|
||||
"label"
|
||||
"literal"
|
||||
"overlay"
|
||||
"progress"
|
||||
"revealer"
|
||||
"scale"
|
||||
"scroll"
|
||||
"transform")))
|
||||
(#any-of? @tag.builtin "box" "button" "calendar" "centerbox" "checkbox" "circular-progress" "color-button" "color-chooser" "combo-box-text" "eventbox" "expander" "graph" "image" "input" "label" "literal" "overlay" "progress" "revealer" "scale" "scroll" "transform")))
|
||||
|
||||
; Variables
|
||||
|
||||
(ident) @variable
|
||||
|
||||
(array
|
||||
(symbol) @variable)
|
||||
|
||||
; Properties & Fields
|
||||
|
||||
(keyword) @property
|
||||
|
||||
(json_access
|
||||
|
|
@ -87,12 +75,10 @@
|
|||
(ident) @variable.member))
|
||||
|
||||
; Functions
|
||||
|
||||
(function_call
|
||||
name: (ident) @function.call)
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
|
|
@ -114,17 +100,29 @@
|
|||
] @operator
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
":"
|
||||
"."
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
[":" "." ","] @punctuation.delimiter
|
||||
["{" "}" "[" "]" "(" ")"] @punctuation.bracket
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
; Ternary expression
|
||||
|
||||
(ternary_expression
|
||||
["?" ":"] @keyword.conditional.ternary)
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @keyword.conditional.ternary)
|
||||
|
||||
; Literals
|
||||
|
||||
(number) @number
|
||||
|
||||
(float) @number.float
|
||||
|
|
@ -132,8 +130,12 @@
|
|||
(boolean) @boolean
|
||||
|
||||
; Strings
|
||||
|
||||
[ (string_fragment) "\"" "'" "`" ] @string
|
||||
[
|
||||
(string_fragment)
|
||||
"\""
|
||||
"'"
|
||||
"`"
|
||||
] @string
|
||||
|
||||
(string_interpolation
|
||||
"${" @punctuation.special
|
||||
|
|
@ -142,5 +144,4 @@
|
|||
(escape_sequence) @string.escape
|
||||
|
||||
; Comments
|
||||
|
||||
(comment) @comment @spell
|
||||
|
|
|
|||
|
|
@ -6,21 +6,32 @@
|
|||
(json_object)
|
||||
(parenthesized_expression)
|
||||
] @indent.begin
|
||||
|
||||
; TODO: can't get this to work, goal is to indent at the property ":" prefix
|
||||
; ((list (identifier) (property)) @indent.align
|
||||
; (#set! indent.open_delimiter "(")
|
||||
; (#set! indent.close_delimiter ")"))
|
||||
|
||||
[")" "}" "]"] @indent.end
|
||||
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @indent.branch
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @indent.end
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
"{"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
(comment) @comment
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
(keyword) @local.definition.field
|
||||
|
||||
(json_object
|
||||
(simplexpr
|
||||
(simplexpr
|
||||
(ident) @local.definition.field))
|
||||
|
||||
(ast_block
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue