aboutsummaryrefslogtreecommitdiffstats
path: root/queries/yuck
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2024-01-06 15:05:50 +0900
committerChristian Clason <c.clason@uni-graz.at>2024-01-19 16:58:37 +0100
commit57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch)
tree70bf645539882b88e6fa129cefd30986b89bbac3 /queries/yuck
parentci: add query lint job (diff)
downloadnvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip
chore: query formatting
Diffstat (limited to 'queries/yuck')
-rw-r--r--queries/yuck/highlights.scm91
-rw-r--r--queries/yuck/indents.scm27
-rw-r--r--queries/yuck/injections.scm3
-rw-r--r--queries/yuck/locals.scm2
4 files changed, 68 insertions, 55 deletions
diff --git a/queries/yuck/highlights.scm b/queries/yuck/highlights.scm
index c885d909d..bd414b8e7 100644
--- a/queries/yuck/highlights.scm
+++ b/queries/yuck/highlights.scm
@@ -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
diff --git a/queries/yuck/indents.scm b/queries/yuck/indents.scm
index bcf028ce4..cd326b923 100644
--- a/queries/yuck/indents.scm
+++ b/queries/yuck/indents.scm
@@ -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.end
-
-[ "{" "}" ] @indent.branch
+[
+ "{"
+ "}"
+] @indent.branch
-[ "(" ")" ] @indent.branch
+[
+ "("
+ ")"
+] @indent.branch
-[ "[" "]" ] @indent.branch
+[
+ "["
+ "]"
+] @indent.branch
[
- (ERROR)
- (comment)
+ (ERROR)
+ (comment)
] @indent.auto
diff --git a/queries/yuck/injections.scm b/queries/yuck/injections.scm
index 4bb7d675d..2f0e58eb6 100644
--- a/queries/yuck/injections.scm
+++ b/queries/yuck/injections.scm
@@ -1 +1,2 @@
-(comment) @comment
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/queries/yuck/locals.scm b/queries/yuck/locals.scm
index 063d59b1a..9f40b2082 100644
--- a/queries/yuck/locals.scm
+++ b/queries/yuck/locals.scm
@@ -13,7 +13,7 @@
(keyword) @local.definition.field
(json_object
- (simplexpr
+ (simplexpr
(ident) @local.definition.field))
(ast_block