|
1 | | -; Upstream: https://github.com/alex-pinkus/tree-sitter-swift/blob/1c586339fb00014b23d6933f2cc32b588a226f3b/queries/highlights.scm |
| 1 | +; Upstream: https://github.com/alex-pinkus/tree-sitter-swift/blob/57c1c6d6ffa1c44b330182d41717e6fe37430704/queries/highlights.scm |
2 | 2 |
|
3 | 3 | (line_string_literal |
4 | 4 | ["\\(" ")"] @punctuation.special) |
|
10 | 10 | (attribute) @variable |
11 | 11 | (type_identifier) @type |
12 | 12 | (self_expression) @variable.builtin |
| 13 | +(user_type (type_identifier) @variable.builtin (#eq? @variable.builtin "Self")) |
13 | 14 |
|
14 | 15 | ; Declarations |
15 | 16 | "func" @keyword.function |
|
23 | 24 | ] @keyword |
24 | 25 |
|
25 | 26 | (function_declaration (simple_identifier) @function.method) |
26 | | -(function_declaration "init" @constructor) |
| 27 | +(init_declaration ["init" @constructor]) |
| 28 | +(deinit_declaration ["deinit" @constructor]) |
| 29 | + |
27 | 30 | (throws) @keyword |
28 | 31 | "async" @keyword |
29 | 32 | "await" @keyword |
|
48 | 51 | "override" |
49 | 52 | "convenience" |
50 | 53 | "required" |
51 | | - "some" |
| 54 | + "mutating" |
| 55 | + "associatedtype" |
| 56 | + "package" |
52 | 57 | "any" |
53 | 58 | ] @keyword |
54 | 59 |
|
| 60 | +(opaque_type ["some" @keyword]) |
| 61 | +(existential_type ["any" @keyword]) |
| 62 | + |
| 63 | +(precedence_group_declaration |
| 64 | + ["precedencegroup" @keyword] |
| 65 | + (simple_identifier) @type) |
| 66 | +(precedence_group_attribute |
| 67 | + (simple_identifier) @keyword |
| 68 | + [(simple_identifier) @type |
| 69 | + (boolean_literal) @constant.builtin.boolean]) |
| 70 | + |
55 | 71 | [ |
56 | 72 | (getter_specifier) |
57 | 73 | (setter_specifier) |
|
73 | 89 | ((navigation_expression |
74 | 90 | (simple_identifier) @type) ; SomeType.method(): highlight SomeType as a type |
75 | 91 | (#match? @type "^[A-Z]")) |
| 92 | +(call_expression (simple_identifier) @keyword (#eq? @keyword "defer")) ; defer { ... } |
| 93 | + |
| 94 | +(try_operator) @operator |
| 95 | +(try_operator ["try" @keyword]) |
76 | 96 |
|
77 | 97 | (directive) @function.macro |
78 | 98 | (diagnostic) @function.macro |
|
136 | 156 |
|
137 | 157 | ; Operators |
138 | 158 | [ |
139 | | - "try" |
140 | | - "try?" |
141 | | - "try!" |
142 | 159 | "!" |
| 160 | + "?" |
143 | 161 | "+" |
144 | 162 | "-" |
145 | 163 | "*" |
|
171 | 189 | "..." |
172 | 190 | (custom_operator) |
173 | 191 | ] @operator |
| 192 | + |
| 193 | +(value_parameter_pack ["each" @keyword]) |
| 194 | +(value_pack_expansion ["repeat" @keyword]) |
| 195 | +(type_parameter_pack ["each" @keyword]) |
| 196 | +(type_pack_expansion ["repeat" @keyword]) |
0 commit comments