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/slint | |
| 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/slint')
| -rw-r--r-- | runtime/queries/slint/folds.scm | 11 | ||||
| -rw-r--r-- | runtime/queries/slint/highlights.scm | 263 | ||||
| -rw-r--r-- | runtime/queries/slint/indents.scm | 26 | ||||
| -rw-r--r-- | runtime/queries/slint/injections.scm | 2 | ||||
| -rw-r--r-- | runtime/queries/slint/locals.scm | 117 |
5 files changed, 419 insertions, 0 deletions
diff --git a/runtime/queries/slint/folds.scm b/runtime/queries/slint/folds.scm new file mode 100644 index 000000000..4c5b1307a --- /dev/null +++ b/runtime/queries/slint/folds.scm @@ -0,0 +1,11 @@ +[ + (anon_struct_block) + (block) + (callback_event) + (component) + (enum_block) + (function_definition) + (global_definition) + (imperative_block) + (struct_block) +] @fold diff --git a/runtime/queries/slint/highlights.scm b/runtime/queries/slint/highlights.scm new file mode 100644 index 000000000..1b56b1c0d --- /dev/null +++ b/runtime/queries/slint/highlights.scm @@ -0,0 +1,263 @@ +(comment) @comment @spell + +; Different types: +(string_value) @string @spell + +(escape_sequence) @string.escape + +(color_value) @constant + +[ + (children_identifier) + (easing_kind_identifier) +] @constant.builtin + +(bool_value) @boolean + +[ + (int_value) + (physical_length_value) +] @number + +[ + (angle_value) + (duration_value) + (float_value) + (length_value) + (percent_value) + (relative_font_size_value) +] @number.float + +(purity) @keyword.modifier + +(function_visibility) @keyword.modifier + +(property_visibility) @keyword.modifier + +(builtin_type_identifier) @type.builtin + +(reference_identifier) @variable.builtin + +(type + [ + (type_list) + (user_type_identifier) + (anon_struct_block) + ]) @type + +(user_type_identifier) @type + +(enum_block + (user_type_identifier) @constant) + +; Functions and callbacks +(argument) @variable.parameter + +(function_call + name: (_) @function.call) + +; definitions +(callback + name: (_) @function) + +(callback_alias + name: (_) @function) + +(callback_event + name: (simple_identifier) @function.call) + +(component + id: (_) @variable) + +(enum_definition + name: (_) @type) + +(function_definition + name: (_) @function) + +(struct_definition + name: (_) @type) + +(typed_identifier + type: (_) @type) + +; Operators +(binary_expression + op: (_) @operator) + +(unary_expression + op: (_) @operator) + +[ + (comparison_operator) + (mult_prec_operator) + (add_prec_operator) + (unary_prec_operator) + (assignment_prec_operator) +] @operator + +[ + ":=" + "=>" + "->" + "<=>" +] @operator + +; Punctuation +[ + ";" + "." + "," + ":" +] @punctuation.delimiter + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +(property + [ + "<" + ">" + ] @punctuation.bracket) + +; Properties, Variables and Constants: +(component + id: (simple_identifier) @constant) + +(property + name: (simple_identifier) @property) + +(binding_alias + name: (simple_identifier) @property) + +(binding + name: (simple_identifier) @property) + +(struct_block + (simple_identifier) @variable.member) + +(anon_struct_block + (simple_identifier) @variable.member) + +(property_assignment + property: (simple_identifier) @property) + +(states_definition + name: (simple_identifier) @variable) + +(callback + name: (simple_identifier) @variable) + +(typed_identifier + name: (_) @variable) + +(simple_indexed_identifier + name: (simple_identifier) @variable + index_var: (simple_identifier) @variable) + +(expression + (simple_identifier) @variable) + +(member_access + member: (expression + (simple_identifier) @property)) + +(states_definition + name: (simple_identifier) @constant) + +; Attributes: +[ + (linear_gradient_identifier) + (radial_gradient_identifier) + (radial_gradient_kind) +] @attribute + +(image_call + "@image-url" @attribute) + +(tr + "@tr" @attribute) + +; Keywords: +(animate_option_identifier) @keyword + +(export) @keyword.import + +(if_statement + "if" @keyword.conditional) + +(if_expr + [ + "if" + "else" + ] @keyword.conditional) + +(ternary_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +(animate_statement + "animate" @keyword) + +(callback + "callback" @keyword) + +(component_definition + [ + "component" + "inherits" + ] @keyword) + +(enum_definition + "enum" @keyword.type) + +(for_loop + [ + "for" + "in" + ] @keyword.repeat) + +(function_definition + "function" @keyword.function) + +(global_definition + "global" @keyword) + +(imperative_block + "return" @keyword.return) + +(import_statement + [ + "import" + "from" + ] @keyword.import) + +(import_type + "as" @keyword.import) + +(property + "property" @keyword) + +(states_definition + [ + "states" + "when" + ] @keyword) + +(struct_definition + "struct" @keyword.type) + +(transitions_definition + [ + "transitions" + "in" + "out" + ] @keyword) diff --git a/runtime/queries/slint/indents.scm b/runtime/queries/slint/indents.scm new file mode 100644 index 000000000..d6bdeacde --- /dev/null +++ b/runtime/queries/slint/indents.scm @@ -0,0 +1,26 @@ +[ + (arguments) + (block) + (enum_block) + (global_block) + (imperative_block) + (struct_block) + (typed_identifier) +] @indent.begin + +([ + (block) + (enum_block) + (global_block) + (imperative_block) + (struct_block) +] + "}" @indent.end) + +([ + (arguments) + (typed_identifier) +] + ")" @indent.end) + +(string_value) @indent.auto diff --git a/runtime/queries/slint/injections.scm b/runtime/queries/slint/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/runtime/queries/slint/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/slint/locals.scm b/runtime/queries/slint/locals.scm new file mode 100644 index 000000000..7e895a6b5 --- /dev/null +++ b/runtime/queries/slint/locals.scm @@ -0,0 +1,117 @@ +[ + (anon_struct_block) + (block) + (callback_event) + (component) + (enum_block) + (function_definition) + (global_definition) + (imperative_block) + (struct_block) +] @local.scope + +(anon_struct_block + (_) @local.definition.field) + +(argument) @local.definition.var + +(callback + name: (_) @local.definition.field) + +(component_definition + name: (_) @local.definition.type) + +(enum_definition + name: (_) @local.definition.type) + +(enum_block + (_) @local.definition.field) + +(function_definition + name: (_) @local.definition.function) + +(global_definition + name: (_) @local.definition.type) + +(import_type + import_name: (_) + !local_name) @local.definition.import + +(import_type + import_name: (_) + local_name: (_) @local.definition.import) + +(property + name: (_) @local.definition.field) + +(struct_block + (_) @local.definition.field) + +(struct_definition + name: (_) @local.definition.type) + +(typed_identifier + name: (_) @local.definition.var) + +(argument + (_) @local.reference) + +(binary_expression + left: (_) @local.reference) + +(binary_expression + right: (_) @local.reference) + +(callback_event + name: (_) @local.reference) + +(component + type: (_) @local.reference + (#set! reference.kind "type")) + +(component_definition + base_type: (_) @local.reference + (#set! reference.kind "type")) + +(function_call + name: (_) @local.reference) + +(index_op + index: (_) @local.reference) + +(index_op + left: (_) @local.reference) + +(member_access + base: (_) @local.reference) + +(member_access + member: (_) @local.reference) + +(parens_op + left: (_) @local.reference) + +(property + type: (_) @local.reference + (#set! reference.kind "type")) + +(property_assignment + property: (_) @local.reference + (#set! reference.kind "field")) + +(property_assignment + value: (_) @local.reference) + +(struct_block + (_) @local.reference + (#set! reference.kind "type")) + +(tr + percent: (_) @local.reference) + +(typed_identifier + type: (_) @local.reference + (#set! reference.kind "type")) + +(unary_expression + left: (_) @local.reference) |
