chore: query formatting

This commit is contained in:
Pham Huy Hoang 2024-01-06 15:05:50 +09:00 committed by Christian Clason
parent 79975d6557
commit 57a8acf0c4
674 changed files with 18466 additions and 12648 deletions

View file

@ -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

View file

@ -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

View file

@ -1 +1,2 @@
(comment) @comment
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -13,7 +13,7 @@
(keyword) @local.definition.field
(json_object
(simplexpr
(simplexpr
(ident) @local.definition.field))
(ast_block