feat!: drop modules, general refactor and cleanup

This commit is contained in:
Christian Clason 2023-06-12 09:54:30 -06:00
parent c13e28f894
commit 2c8f2f2fad
829 changed files with 4905 additions and 8010 deletions

View file

@ -0,0 +1,9 @@
[
(ast_block)
(list)
(array)
(expr)
(json_array)
(json_object)
(parenthesized_expression)
] @fold

View file

@ -0,0 +1,150 @@
; 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 .
((symbol) @include
(#eq? @include "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 .
((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
(function_call
name: (ident) @function.call)
; Operators
[
"+"
"-"
"*"
"/"
"%"
"||"
"&&"
"=="
"!="
"=~"
">"
"<"
">="
"<="
"!"
"?."
"?:"
] @operator
; Punctuation
[":" "." ","] @punctuation.delimiter
["{" "}" "[" "]" "(" ")"] @punctuation.bracket
; Ternary expression
(ternary_expression
["?" ":"] @conditional.ternary)
; Literals
(number) @number
(float) @float
(boolean) @boolean
; Strings
[ (string_fragment) "\"" "'" "`" ] @string
(string_interpolation
"${" @punctuation.special
"}" @punctuation.special)
(escape_sequence) @string.escape
; Comments
(comment) @comment @spell
; Errors
(ERROR) @error

View file

@ -0,0 +1,26 @@
[
(ast_block)
(array)
(expr)
(json_array)
(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
[
(ERROR)
(comment)
] @indent.auto

View file

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

View file

@ -0,0 +1,21 @@
[
(ast_block)
(list)
(array)
(expr)
(json_array)
(json_object)
(parenthesized_expression)
] @scope
(symbol) @reference
(keyword) @definition.field
(json_object
(simplexpr
(ident) @definition.field))
(ast_block
(symbol)
(ident) @definition.type)