mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 01:10:02 -04:00
feat: improve yuck highlighting
This commit is contained in:
parent
fc1ca10bfb
commit
1de237d10d
2 changed files with 85 additions and 144 deletions
|
|
@ -516,7 +516,7 @@
|
||||||
"revision": "2c0e6be8dd4dcb961c345fa35c309ad4f5bd3502"
|
"revision": "2c0e6be8dd4dcb961c345fa35c309ad4f5bd3502"
|
||||||
},
|
},
|
||||||
"yuck": {
|
"yuck": {
|
||||||
"revision": "fefe8e32ac5306b261af6af52571e13edf7b420c"
|
"revision": "e3d91a3c65decdea467adebe4127b8366fa47919"
|
||||||
},
|
},
|
||||||
"zig": {
|
"zig": {
|
||||||
"revision": "f3bc9ffe9ca10f52dee01999b5b6ce9a4074b0ac"
|
"revision": "f3bc9ffe9ca10f52dee01999b5b6ce9a4074b0ac"
|
||||||
|
|
|
||||||
|
|
@ -1,148 +1,96 @@
|
||||||
; Tags
|
; Tags
|
||||||
|
|
||||||
|
; TODO apply to every symbol in list? I think it should probably only be applied to the first child of the list
|
||||||
(list
|
(list
|
||||||
(symbol) @tag)
|
(symbol) @tag)
|
||||||
|
|
||||||
; Includes
|
; Includes
|
||||||
|
|
||||||
((symbol) @include
|
(list .
|
||||||
(#match? @include "include"))
|
((symbol) @include
|
||||||
|
(#eq? @include "include")))
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
((symbol) @keyword
|
; I think there's a bug in tree-sitter the anchor doesn't seem to be working, see
|
||||||
(#any-of? @keyword "defwindow" "defwidget" "defvar" "defpoll" "deflisten" "for" "geometry" "children" "struts"))
|
; https://github.com/tree-sitter/tree-sitter/pull/2107
|
||||||
|
(list .
|
||||||
|
((symbol) @keyword
|
||||||
|
(#any-of? @keyword "defwindow" "defwidget" "defvar" "defpoll" "deflisten" "geometry" "children" "struts")))
|
||||||
|
|
||||||
|
; Loop
|
||||||
|
|
||||||
|
(loop_widget . "for" @repeat . (symbol) @variable . "in" @keyword.operator)
|
||||||
|
|
||||||
|
(loop_widget . "for" @repeat . (symbol) @variable . "in" @keyword.operator . (symbol) @variable)
|
||||||
|
|
||||||
|
; Builtin widgets
|
||||||
|
|
||||||
|
(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")))
|
||||||
|
|
||||||
|
; Variables
|
||||||
|
|
||||||
|
(ident) @variable
|
||||||
|
|
||||||
|
(array
|
||||||
|
(symbol) @variable)
|
||||||
|
|
||||||
|
; 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)
|
||||||
|
|
||||||
|
(json_object
|
||||||
|
(simplexpr
|
||||||
|
(ident) @field))
|
||||||
|
|
||||||
; Functions
|
; Functions
|
||||||
|
|
||||||
(function_call
|
(function_call
|
||||||
name: (ident) @function.call)
|
name: (ident) @function.call)
|
||||||
|
|
||||||
; Variables
|
|
||||||
|
|
||||||
(array
|
|
||||||
(symbol) @variable)
|
|
||||||
|
|
||||||
(binary_expression
|
|
||||||
(simplexpr
|
|
||||||
(ident) @variable))
|
|
||||||
|
|
||||||
(unary_expression
|
|
||||||
(simplexpr
|
|
||||||
(ident) @variable))
|
|
||||||
|
|
||||||
(ternary_expression
|
|
||||||
(simplexpr
|
|
||||||
(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
|
|
||||||
|
|
||||||
(json_access
|
|
||||||
(_)
|
|
||||||
"["
|
|
||||||
(simplexpr
|
|
||||||
(ident) @property))
|
|
||||||
|
|
||||||
(json_safe_access
|
|
||||||
(_)
|
|
||||||
"?."
|
|
||||||
"["
|
|
||||||
(simplexpr
|
|
||||||
(ident) @property))
|
|
||||||
|
|
||||||
(json_dot_access
|
|
||||||
(index) @property)
|
|
||||||
|
|
||||||
(json_safe_dot_access
|
|
||||||
(index) @property)
|
|
||||||
|
|
||||||
(json_object
|
|
||||||
(simplexpr
|
|
||||||
(ident) @field))
|
|
||||||
|
|
||||||
; Operators
|
|
||||||
|
|
||||||
[
|
|
||||||
"+"
|
|
||||||
"-"
|
|
||||||
"*"
|
|
||||||
"/"
|
|
||||||
"%"
|
|
||||||
"&&"
|
|
||||||
"||"
|
|
||||||
"=="
|
|
||||||
"!="
|
|
||||||
"=~"
|
|
||||||
">="
|
|
||||||
"<="
|
|
||||||
">"
|
|
||||||
"<"
|
|
||||||
"?:"
|
|
||||||
"?."
|
|
||||||
"!"
|
|
||||||
] @operator
|
|
||||||
|
|
||||||
(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)
|
|
||||||
|
|
||||||
(json_object
|
|
||||||
(simplexpr
|
|
||||||
(ident) @field))
|
|
||||||
|
|
||||||
; Operators
|
; Operators
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -162,21 +110,19 @@
|
||||||
"<="
|
"<="
|
||||||
"!"
|
"!"
|
||||||
"?."
|
"?."
|
||||||
|
"?:"
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
(ternary_expression
|
|
||||||
["?" ":"] @conditional.ternary)
|
|
||||||
|
|
||||||
; Punctuation
|
; Punctuation
|
||||||
|
|
||||||
[
|
[":" "." ","] @punctuation.delimiter
|
||||||
":"
|
|
||||||
"."
|
|
||||||
","
|
|
||||||
] @punctuation.delimiter
|
|
||||||
|
|
||||||
["{" "}" "[" "]" "(" ")"] @punctuation.bracket
|
["{" "}" "[" "]" "(" ")"] @punctuation.bracket
|
||||||
|
|
||||||
|
; Ternary expression
|
||||||
|
|
||||||
|
(ternary_expression
|
||||||
|
["?" ":"] @conditional.ternary)
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
(number) @number
|
(number) @number
|
||||||
|
|
@ -199,11 +145,6 @@
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
; Other stuff that has not been catched by the previous queries yet
|
|
||||||
|
|
||||||
(ident) @variable
|
|
||||||
(index) @property
|
|
||||||
|
|
||||||
; Errors
|
; Errors
|
||||||
|
|
||||||
(ERROR) @error
|
(ERROR) @error
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue