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 ; Includes
(list (list
. .
((symbol) @keyword.import (symbol) @keyword.import
(#eq? @keyword.import "include"))) (#eq? @keyword.import "include"))
; Keywords ; 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 (symbol) @keyword
(#any-of? @keyword "defwindow" "defwidget" "defvar" "defpoll" "deflisten" "geometry" "children" "struts"))) (#any-of? @keyword "defwindow" "defwidget" "defvar" "defpoll" "deflisten" "geometry" "children" "struts"))
; Loop ; Loop
(loop_widget (loop_widget
@ -39,8 +37,8 @@
; Builtin widgets ; Builtin widgets
(list (list
. .
((symbol) @tag.builtin (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 ; Variables
(ident) @variable (ident) @variable
@ -48,7 +46,10 @@
(array (array
(symbol) @variable) (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 (keyword) @property
(json_access (json_access
@ -72,7 +73,7 @@
(json_object (json_object
(simplexpr (simplexpr
(ident) @variable.member)) (ident) @property))
; Functions ; Functions
(function_call (function_call

View file

@ -1,2 +1,26 @@
((comment) @injection.content ((comment) @injection.content
(#set! injection.language "comment")) (#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))