Skip to content

Commit 9b1e5d4

Browse files
committed
Differentiate between function and method tokens
1 parent 5e9e3c3 commit 9b1e5d4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Sources/SourceKitLSP/Swift/SemanticTokenParser.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public struct SemanticToken: Hashable {
5858
case typeParameter
5959
case function
6060
case macro
61+
case method
6162
case variable
6263
case parameter
6364
case property
@@ -82,6 +83,7 @@ public struct SemanticToken: Hashable {
8283
case .typeParameter: return "typeParameter"
8384
case .function: return "function"
8485
case .macro: return "macro"
86+
case .method: return "method"
8587
case .variable: return "variable"
8688
case .parameter: return "parameter"
8789
case .property: return "property"
@@ -285,19 +287,21 @@ struct SemanticTokenParser {
285287
return (.typeParameter, [])
286288
case values.decl_function_constructor,
287289
values.decl_function_subscript,
288-
values.decl_function_free,
289-
values.decl_function_method_static,
290+
values.decl_function_free:
291+
return (.function, [.declaration])
292+
case values.decl_function_method_static,
290293
values.decl_function_method_instance,
291294
values.decl_function_method_class:
292-
return (.function, [.declaration])
295+
return (.method, [.declaration])
293296
case values.ref_function_constructor,
294297
values.ref_function_destructor,
295298
values.ref_function_free,
296-
values.ref_function_subscript,
297-
values.ref_function_method_static,
299+
values.ref_function_subscript:
300+
return (.function, [])
301+
case values.ref_function_method_static,
298302
values.ref_function_method_instance,
299303
values.ref_function_method_class:
300-
return (.function, [])
304+
return (.method, [])
301305
case values.decl_function_operator_prefix,
302306
values.decl_function_operator_postfix,
303307
values.decl_function_operator_infix:

0 commit comments

Comments
 (0)