diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2023-06-12 09:54:30 -0600 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2025-05-12 18:43:40 +0200 |
| commit | 692b051b09935653befdb8f7ba8afdb640adf17b (patch) | |
| tree | 167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/yuck | |
| parent | feat(c-family): inherit injections (diff) | |
| download | nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2 nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip | |
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/yuck')
| -rw-r--r-- | runtime/queries/yuck/folds.scm | 9 | ||||
| -rw-r--r-- | runtime/queries/yuck/highlights.scm | 154 | ||||
| -rw-r--r-- | runtime/queries/yuck/indents.scm | 30 | ||||
| -rw-r--r-- | runtime/queries/yuck/injections.scm | 26 | ||||
| -rw-r--r-- | runtime/queries/yuck/locals.scm | 21 |
5 files changed, 240 insertions, 0 deletions
diff --git a/runtime/queries/yuck/folds.scm b/runtime/queries/yuck/folds.scm new file mode 100644 index 000000000..bad5a07c9 --- /dev/null +++ b/runtime/queries/yuck/folds.scm @@ -0,0 +1,9 @@ +[ + (ast_block) + (list) + (array) + (expr) + (json_array) + (json_object) + (parenthesized_expression) +] @fold diff --git a/runtime/queries/yuck/highlights.scm b/runtime/queries/yuck/highlights.scm new file mode 100644 index 000000000..7b9a9d203 --- /dev/null +++ b/runtime/queries/yuck/highlights.scm @@ -0,0 +1,154 @@ +; 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) @keyword.import + (#eq? @keyword.import "include")) + +; Keywords +(list + . + (symbol) @keyword + (#any-of? @keyword + "defwindow" "defwidget" "defvar" "defpoll" "deflisten" "geometry" "children" "struts")) + +; Loop +(loop_widget + . + "for" @keyword.repeat + . + (symbol) @variable + . + "in" @keyword.operator) + +(loop_widget + . + "for" @keyword.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) + +((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 + (_) + "[" + (simplexpr + (ident) @property)) + +(json_safe_access + (_) + "?." + "[" + (simplexpr + (ident) @property)) + +(json_dot_access + (index) @property) + +(json_safe_dot_access + (index) @property) + +(json_object + (simplexpr + (ident) @property)) + +; Functions +(function_call + name: (ident) @function.call) + +; Operators +[ + "+" + "-" + "*" + "/" + "%" + "||" + "&&" + "==" + "!=" + "=~" + ">" + "<" + ">=" + "<=" + "!" + "?." + "?:" +] @operator + +; Punctuation +[ + ":" + "." + "," +] @punctuation.delimiter + +[ + "{" + "}" + "[" + "]" + "(" + ")" +] @punctuation.bracket + +; Ternary expression +(ternary_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +; Literals +(number) @number + +(float) @number.float + +(boolean) @boolean + +; Strings +[ + (string_fragment) + "\"" + "'" + "`" +] @string + +(string_interpolation + "${" @punctuation.special + "}" @punctuation.special) + +(escape_sequence) @string.escape + +; Comments +(comment) @comment @spell diff --git a/runtime/queries/yuck/indents.scm b/runtime/queries/yuck/indents.scm new file mode 100644 index 000000000..515795021 --- /dev/null +++ b/runtime/queries/yuck/indents.scm @@ -0,0 +1,30 @@ +[ + (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 + +; I do not know what/when this should be added. +; Commenting this out for now +; [ +; "(" +; "{" +; "[" +; ] @indent.branch +[ + (ERROR) + (comment) +] @indent.auto diff --git a/runtime/queries/yuck/injections.scm b/runtime/queries/yuck/injections.scm new file mode 100644 index 000000000..298a8d070 --- /dev/null +++ b/runtime/queries/yuck/injections.scm @@ -0,0 +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)) diff --git a/runtime/queries/yuck/locals.scm b/runtime/queries/yuck/locals.scm new file mode 100644 index 000000000..9f40b2082 --- /dev/null +++ b/runtime/queries/yuck/locals.scm @@ -0,0 +1,21 @@ +[ + (ast_block) + (list) + (array) + (expr) + (json_array) + (json_object) + (parenthesized_expression) +] @local.scope + +(symbol) @local.reference + +(keyword) @local.definition.field + +(json_object + (simplexpr + (ident) @local.definition.field)) + +(ast_block + (symbol) + (ident) @local.definition.type) |
