feat(yuck): add missing injections

And builtin variable highlights
This commit is contained in:
ObserverOfTime 2024-01-21 12:57:34 +02:00 committed by Christian Clason
parent d23192fb17
commit 8166080035
2 changed files with 35 additions and 10 deletions

View file

@ -6,16 +6,14 @@
; Includes
(list
.
((symbol) @keyword.import
(#eq? @keyword.import "include")))
(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
.
((symbol) @keyword
(#any-of? @keyword "defwindow" "defwidget" "defvar" "defpoll" "deflisten" "geometry" "children" "struts")))
(symbol) @keyword
(#any-of? @keyword "defwindow" "defwidget" "defvar" "defpoll" "deflisten" "geometry" "children" "struts"))
; Loop
(loop_widget
@ -39,8 +37,8 @@
; 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")))
(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
@ -48,7 +46,10 @@
(array
(symbol) @variable)
; Properties & Fields
((ident) @variable.builtin
(#any-of? @variable.builtin "EWW_TEMPS" "EWW_RAM" "EWW_DISK" "EWW_BATTERY" "EWW_CPU" "EWW_NET" "EWW_TIME" "EWW_CONFIG_DIR" "EWW_CMD" "EWW_EXECUTABLE"))
; Properties
(keyword) @property
(json_access
@ -72,7 +73,7 @@
(json_object
(simplexpr
(ident) @variable.member))
(ident) @property))
; Functions
(function_call

View file

@ -1,2 +1,26 @@
((comment) @injection.content
(#set! injection.language "comment"))
((function_call
name: (ident) @_name
.
(simplexpr)
.
(simplexpr
(string
(string_fragment) @injection.content)+))
(#any-of? @_name "replace" "search" "matches" "captures")
(#set! injection.language "regex")
(#set! injection.combined))
((function_call
name: (ident) @_name
.
(simplexpr)
.
(simplexpr
(string
(string_fragment) @injection.content)+))
(#eq? @_name "jq")
(#set! injection.language "jq")
(#set! injection.combined))