Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/swift/highlights.scm')
-rw-r--r--runtime/queries/swift/highlights.scm35
1 files changed, 29 insertions, 6 deletions
diff --git a/runtime/queries/swift/highlights.scm b/runtime/queries/swift/highlights.scm
index e7610e38..42411d90 100644
--- a/runtime/queries/swift/highlights.scm
+++ b/runtime/queries/swift/highlights.scm
@@ -1,4 +1,4 @@
-; Upstream: https://github.com/alex-pinkus/tree-sitter-swift/blob/1c586339fb00014b23d6933f2cc32b588a226f3b/queries/highlights.scm
+; Upstream: https://github.com/alex-pinkus/tree-sitter-swift/blob/57c1c6d6ffa1c44b330182d41717e6fe37430704/queries/highlights.scm
(line_string_literal
["\\(" ")"] @punctuation.special)
@@ -10,6 +10,7 @@
(attribute) @variable
(type_identifier) @type
(self_expression) @variable.builtin
+(user_type (type_identifier) @variable.builtin (#eq? @variable.builtin "Self"))
; Declarations
"func" @keyword.function
@@ -23,7 +24,9 @@
] @keyword
(function_declaration (simple_identifier) @function.method)
-(function_declaration "init" @constructor)
+(init_declaration ["init" @constructor])
+(deinit_declaration ["deinit" @constructor])
+
(throws) @keyword
"async" @keyword
"await" @keyword
@@ -48,10 +51,23 @@
"override"
"convenience"
"required"
- "some"
+ "mutating"
+ "associatedtype"
+ "package"
"any"
] @keyword
+(opaque_type ["some" @keyword])
+(existential_type ["any" @keyword])
+
+(precedence_group_declaration
+ ["precedencegroup" @keyword]
+ (simple_identifier) @type)
+(precedence_group_attribute
+ (simple_identifier) @keyword
+ [(simple_identifier) @type
+ (boolean_literal) @constant.builtin.boolean])
+
[
(getter_specifier)
(setter_specifier)
@@ -73,6 +89,10 @@
((navigation_expression
(simple_identifier) @type) ; SomeType.method(): highlight SomeType as a type
(#match? @type "^[A-Z]"))
+(call_expression (simple_identifier) @keyword (#eq? @keyword "defer")) ; defer { ... }
+
+(try_operator) @operator
+(try_operator ["try" @keyword])
(directive) @function.macro
(diagnostic) @function.macro
@@ -136,10 +156,8 @@
; Operators
[
- "try"
- "try?"
- "try!"
"!"
+ "?"
"+"
"-"
"*"
@@ -171,3 +189,8 @@
"..."
(custom_operator)
] @operator
+
+(value_parameter_pack ["each" @keyword])
+(value_pack_expansion ["repeat" @keyword])
+(type_parameter_pack ["each" @keyword])
+(type_pack_expansion ["repeat" @keyword])