Skip to content

Commit 5fe7cdc

Browse files
authored
Add slint (#1123)
* Add slint * Add scm, update workflow and changelog * Use spaces instead of tab
1 parent d9c26fc commit 5fe7cdc

File tree

5 files changed

+272
-0
lines changed

5 files changed

+272
-0
lines changed

.github/workflows/update-grammars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ jobs:
100100
- rust
101101
- scala
102102
- scheme
103+
- slint
103104
- smithy
104105
- solidity
105106
- sql

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,3 +624,9 @@
624624
update = none
625625
ignore = dirty
626626
branch = main
627+
[submodule "repos/slint"]
628+
path = repos/slint
629+
url = https://github.com/slint-ui/tree-sitter-slint
630+
update = none
631+
ignore = dirty
632+
branch = master

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
## Unreleased
4+
- Add slint tree sitter repo. This does not have an associated mode.
45

56
## 0.12.296 - 2025-08-03
67

queries/slint/highlights.scm

Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
(comment) @comment @spell
2+
3+
; Different types:
4+
(string_value) @string @spell
5+
6+
(escape_sequence) @string.escape
7+
8+
(color_value) @constant
9+
10+
[
11+
(children_identifier)
12+
(easing_kind_identifier)
13+
] @constant.builtin
14+
15+
(bool_value) @boolean
16+
17+
[
18+
(int_value)
19+
(physical_length_value)
20+
] @number
21+
22+
[
23+
(angle_value)
24+
(duration_value)
25+
(float_value)
26+
(length_value)
27+
(percent_value)
28+
(relative_font_size_value)
29+
] @number.float
30+
31+
(purity) @keyword.modifier
32+
33+
(function_visibility) @keyword.modifier
34+
35+
(property_visibility) @keyword.modifier
36+
37+
(builtin_type_identifier) @type.builtin
38+
39+
(reference_identifier) @variable.builtin
40+
41+
(type
42+
[
43+
(type_list)
44+
(user_type_identifier)
45+
(anon_struct_block)
46+
]) @type
47+
48+
(user_type_identifier) @type
49+
50+
(enum_block
51+
(user_type_identifier) @constant)
52+
53+
; Functions and callbacks
54+
(argument) @variable.parameter
55+
56+
(function_call
57+
name: (_) @function.call)
58+
59+
; definitions
60+
(callback
61+
name: (_) @function)
62+
63+
(callback_alias
64+
name: (_) @function)
65+
66+
(callback_event
67+
name: (simple_identifier) @function.call)
68+
69+
(component
70+
id: (_) @variable)
71+
72+
(enum_definition
73+
name: (_) @type)
74+
75+
(function_definition
76+
name: (_) @function)
77+
78+
(struct_definition
79+
name: (_) @type)
80+
81+
(typed_identifier
82+
type: (_) @type)
83+
84+
; Operators
85+
(binary_expression
86+
op: (_) @operator)
87+
88+
(unary_expression
89+
op: (_) @operator)
90+
91+
[
92+
(comparison_operator)
93+
(mult_prec_operator)
94+
(add_prec_operator)
95+
(unary_prec_operator)
96+
(assignment_prec_operator)
97+
] @operator
98+
99+
[
100+
":="
101+
"=>"
102+
"->"
103+
"<=>"
104+
] @operator
105+
106+
; Punctuation
107+
[
108+
";"
109+
"."
110+
","
111+
":"
112+
] @punctuation.delimiter
113+
114+
[
115+
"("
116+
")"
117+
"["
118+
"]"
119+
"{"
120+
"}"
121+
] @punctuation.bracket
122+
123+
(property
124+
[
125+
"<"
126+
">"
127+
] @punctuation.bracket)
128+
129+
; Properties, Variables and Constants:
130+
(component
131+
id: (simple_identifier) @constant)
132+
133+
(property
134+
name: (simple_identifier) @property)
135+
136+
(binding_alias
137+
name: (simple_identifier) @property)
138+
139+
(binding
140+
name: (simple_identifier) @property)
141+
142+
(struct_block
143+
(simple_identifier) @variable.member)
144+
145+
(anon_struct_block
146+
(simple_identifier) @variable.member)
147+
148+
(property_assignment
149+
property: (simple_identifier) @property)
150+
151+
(states_definition
152+
name: (simple_identifier) @variable)
153+
154+
(callback
155+
name: (simple_identifier) @variable)
156+
157+
(typed_identifier
158+
name: (_) @variable)
159+
160+
(simple_indexed_identifier
161+
name: (simple_identifier) @variable
162+
index_var: (simple_identifier) @variable)
163+
164+
(expression
165+
(simple_identifier) @variable)
166+
167+
(member_access
168+
member: (expression
169+
(simple_identifier) @property))
170+
171+
(states_definition
172+
name: (simple_identifier) @constant)
173+
174+
; Attributes:
175+
[
176+
(linear_gradient_identifier)
177+
(radial_gradient_identifier)
178+
(radial_gradient_kind)
179+
] @attribute
180+
181+
(image_call
182+
"@image-url" @attribute)
183+
184+
(tr
185+
"@tr" @attribute)
186+
187+
; Keywords:
188+
(animate_option_identifier) @keyword
189+
190+
(export) @keyword.import
191+
192+
(if_statement
193+
"if" @keyword.conditional)
194+
195+
(if_expr
196+
[
197+
"if"
198+
"else"
199+
] @keyword.conditional)
200+
201+
(ternary_expression
202+
[
203+
"?"
204+
":"
205+
] @keyword.conditional.ternary)
206+
207+
(animate_statement
208+
"animate" @keyword)
209+
210+
(callback
211+
"callback" @keyword)
212+
213+
(component_definition
214+
[
215+
"component"
216+
"inherits"
217+
] @keyword)
218+
219+
(enum_definition
220+
"enum" @keyword.type)
221+
222+
(for_loop
223+
[
224+
"for"
225+
"in"
226+
] @keyword.repeat)
227+
228+
(function_definition
229+
"function" @keyword.function)
230+
231+
(global_definition
232+
"global" @keyword)
233+
234+
(imperative_block
235+
"return" @keyword.return)
236+
237+
(import_statement
238+
[
239+
"import"
240+
"from"
241+
] @keyword.import)
242+
243+
(import_type
244+
"as" @keyword.import)
245+
246+
(property
247+
"property" @keyword)
248+
249+
(states_definition
250+
[
251+
"states"
252+
"when"
253+
] @keyword)
254+
255+
(struct_definition
256+
"struct" @keyword.type)
257+
258+
(transitions_definition
259+
[
260+
"transitions"
261+
"in"
262+
"out"
263+
] @keyword)

repos/slint

Submodule slint added at 96bc969

0 commit comments

Comments
 (0)