From 12030f6d16e35070a851761d524414f8e15c4294 Mon Sep 17 00:00:00 2001 From: Aidan Date: Sat, 2 Aug 2025 13:19:28 -0500 Subject: [PATCH 1/3] Add slint --- .gitmodules | 6 ++++++ repos/slint | 1 + 2 files changed, 7 insertions(+) create mode 160000 repos/slint diff --git a/.gitmodules b/.gitmodules index 1fb4eb84c..f29cdd662 100644 --- a/.gitmodules +++ b/.gitmodules @@ -624,3 +624,9 @@ update = none ignore = dirty branch = main +[submodule "repos/slint"] + path = repos/slint + url = https://github.com/slint-ui/tree-sitter-slint + update = none + ignore = dirty + branch = master diff --git a/repos/slint b/repos/slint new file mode 160000 index 000000000..96bc969d2 --- /dev/null +++ b/repos/slint @@ -0,0 +1 @@ +Subproject commit 96bc969d20ff347030519184ea2467f4046a524d From e6f9f48bdb273affa8c4fb60a6cf73c5aa8dacaa Mon Sep 17 00:00:00 2001 From: Aidan Date: Tue, 5 Aug 2025 12:19:51 -0500 Subject: [PATCH 2/3] Add scm, update workflow and changelog --- .github/workflows/update-grammars.yml | 1 + CHANGELOG.md | 1 + queries/slint/highlights.scm | 263 ++++++++++++++++++++++++++ 3 files changed, 265 insertions(+) create mode 100644 queries/slint/highlights.scm diff --git a/.github/workflows/update-grammars.yml b/.github/workflows/update-grammars.yml index a026168d3..deedabc1d 100644 --- a/.github/workflows/update-grammars.yml +++ b/.github/workflows/update-grammars.yml @@ -100,6 +100,7 @@ jobs: - rust - scala - scheme + - slint - smithy - solidity - sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 60bca9567..83b40c379 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Unreleased +- Add slint tree sitter repo. This does not have an associated mode. ## 0.12.295 - 2025-07-27 diff --git a/queries/slint/highlights.scm b/queries/slint/highlights.scm new file mode 100644 index 000000000..1b56b1c0d --- /dev/null +++ b/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) From 14d7ae00c2a244925c67ccca5c757ff62874e1ce Mon Sep 17 00:00:00 2001 From: Aidan Date: Tue, 5 Aug 2025 12:21:52 -0500 Subject: [PATCH 3/3] Use spaces instead of tab --- .github/workflows/update-grammars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-grammars.yml b/.github/workflows/update-grammars.yml index deedabc1d..61c8574e7 100644 --- a/.github/workflows/update-grammars.yml +++ b/.github/workflows/update-grammars.yml @@ -100,7 +100,7 @@ jobs: - rust - scala - scheme - - slint + - slint - smithy - solidity - sql