aboutsummaryrefslogtreecommitdiffstats
path: root/queries
diff options
context:
space:
mode:
authorPhilipp Mildenberger <philipp@mildenberger.me>2023-03-10 03:04:16 +0100
committerAmaan Qureshi <amaanq12@gmail.com>2023-03-09 22:43:55 -0500
commit1de237d10d2d3da8458125327481dffbf6594f82 (patch)
tree54e18eece887f0f89fde192364d82ad65afb0f2e /queries
parenthighlights(sql): add new keywords and datatypes (diff)
downloadnvim-treesitter-1de237d10d2d3da8458125327481dffbf6594f82.tar
nvim-treesitter-1de237d10d2d3da8458125327481dffbf6594f82.tar.gz
nvim-treesitter-1de237d10d2d3da8458125327481dffbf6594f82.tar.bz2
nvim-treesitter-1de237d10d2d3da8458125327481dffbf6594f82.tar.lz
nvim-treesitter-1de237d10d2d3da8458125327481dffbf6594f82.tar.xz
nvim-treesitter-1de237d10d2d3da8458125327481dffbf6594f82.tar.zst
nvim-treesitter-1de237d10d2d3da8458125327481dffbf6594f82.zip
feat: improve yuck highlighting
Diffstat (limited to 'queries')
-rw-r--r--queries/yuck/highlights.scm171
1 files changed, 56 insertions, 115 deletions
diff --git a/queries/yuck/highlights.scm b/queries/yuck/highlights.scm
index 8b2ca5814..0caf78c84 100644
--- a/queries/yuck/highlights.scm
+++ b/queries/yuck/highlights.scm
@@ -1,69 +1,64 @@
; 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
-((symbol) @include
- (#match? @include "include"))
+(list .
+ ((symbol) @include
+ (#eq? @include "include")))
; Keywords
-((symbol) @keyword
- (#any-of? @keyword "defwindow" "defwidget" "defvar" "defpoll" "deflisten" "for" "geometry" "children" "struts"))
+; 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 .
+ ((symbol) @keyword
+ (#any-of? @keyword "defwindow" "defwidget" "defvar" "defpoll" "deflisten" "geometry" "children" "struts")))
-; Functions
+; Loop
-(function_call
- name: (ident) @function.call)
+(loop_widget . "for" @repeat . (symbol) @variable . "in" @keyword.operator)
-; Variables
+(loop_widget . "for" @repeat . (symbol) @variable . "in" @keyword.operator . (symbol) @variable)
-(array
- (symbol) @variable)
+; Builtin widgets
-(binary_expression
- (simplexpr
- (ident) @variable))
+(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")))
-(unary_expression
- (simplexpr
- (ident) @variable))
+; Variables
-(ternary_expression
- (simplexpr
- (ident) @variable))
+(ident) @variable
(array
(symbol) @variable)
-(json_access
- (simplexpr
- (ident) @variable))
-
-(json_safe_access
- (simplexpr
- (ident) @variable))
-
-(json_array
- (simplexpr
- (ident) @variable))
-
-(json_dot_access
- (simplexpr
- (ident) @variable))
-
-(json_safe_dot_access
- (simplexpr
- (ident) @variable))
-
-(json_object
- (_)
- ":"
- (simplexpr
- (ident) @variable))
-
; Properties & Fields
(keyword) @property
@@ -71,15 +66,15 @@
(json_access
(_)
"["
- (simplexpr
- (ident) @property))
+ (simplexpr
+ (ident) @property))
(json_safe_access
(_)
"?."
"["
- (simplexpr
- (ident) @property))
+ (simplexpr
+ (ident) @property))
(json_dot_access
(index) @property)
@@ -88,60 +83,13 @@
(index) @property)
(json_object
- (simplexpr
- (ident) @field))
-
-; Operators
-
-[
- "+"
- "-"
- "*"
- "/"
- "%"
- "&&"
- "||"
- "=="
- "!="
- "=~"
- ">="
- "<="
- ">"
- "<"
- "?:"
- "?."
- "!"
-] @operator
+ (simplexpr
+ (ident) @field))
-(ternary_expression
- ["?" ":"] @conditional.ternary)
-
-; Properties & Fields
-
-(keyword) @property
-
-(json_access
- (_)
- "["
- (simplexpr
- (ident) @property))
-
-(json_safe_access
- (_)
- "?."
- "["
- (simplexpr
- (ident) @property))
-
-(json_dot_access
- (index) @property)
-
-(json_safe_dot_access
- (index) @property)
+; Functions
-(json_object
- (simplexpr
- (ident) @field))
+(function_call
+ name: (ident) @function.call)
; Operators
@@ -162,21 +110,19 @@
"<="
"!"
"?."
+ "?:"
] @operator
-(ternary_expression
- ["?" ":"] @conditional.ternary)
-
; Punctuation
-[
- ":"
- "."
- ","
-] @punctuation.delimiter
-
+[":" "." ","] @punctuation.delimiter
["{" "}" "[" "]" "(" ")"] @punctuation.bracket
+; Ternary expression
+
+(ternary_expression
+ ["?" ":"] @conditional.ternary)
+
; Literals
(number) @number
@@ -199,11 +145,6 @@
(comment) @comment @spell
-; Other stuff that has not been catched by the previous queries yet
-
-(ident) @variable
-(index) @property
-
; Errors
(ERROR) @error