The attached Objective-C main.m file seems to get completely wrong semantic highlighting.
I tested this with a buildserver-enabled project and also with a fresh, compilation-database project + SourceKit LSP. VSCode had shown the same token types and modifiers.
Swift 6.3.3 with both Xcode and Swiftly toolchain on Linux (Swiftly) and macOS (both).
I noticed a translation of token types in the log.
Is it possible that there's a missing (reverse) mapping?
Interpreting the SourceKit token type values as clangd values would show a much more reasonable highlighting (e.g. "class" instead of "parameter" for mapping "8: 2"). If that's true, then it would indicate a missing mapping of types received by clangd to the SourceKit LSP types, as far as I understand.
Thanks!
#import <Foundation/Foundation.h>
@interface MyClass: NSObject // <- "MyClass" is "parameter", "NSObject" is "parameter"
@end
@implementation MyClass // <- "MyClass" is "parameter"
@end
int main(int argc, char* argv[]) { // <- "main" is "type", "argc" is "variable"
}
Legend emitted by SourceKit LSP via dynamic registration
"legend": {
"tokenModifiers": [
"declaration",
"definition",
"deprecated",
"deduced",
"readonly",
"static",
"abstract",
"virtual",
"dependentName",
"defaultLibrary",
"usedAsMutableReference",
"usedAsMutablePointer",
"constructorOrDestructor",
"userDefined",
"functionScope",
"classScope",
"fileScope",
"globalScope"
],
"tokenTypes": [
"variable",
"variable",
"parameter",
"function",
"method",
"function",
"property",
"variable",
"class",
"interface",
"enum",
"enumMember",
"type",
"type",
"unknown",
"namespace",
"typeParameter",
"concept",
"type",
"macro",
"modifier",
"operator",
"bracket",
"label",
"comment"
]
}
clangd -> SourceKit translations from the Log:
2026-07-30 14:04:28.894227+0200 0x3af211 Info 0x0 55926 0 sourcekit-lsp: [org.swift.sourcekit-lsp:notification-2] clangd token type translations (1/1)
0: 8
1: 8
2: 7
3: 12
4: 13
5: 12
6: 9
7: 8
8: 2
9: 4
10: 3
11: 10
12: 1
13: 1
14: 26
15: 0
16: 6
17: 25
18: 1
19: 14
20: 16
22: 23
23: 24
24: 17
2026-07-30 14:04:28.894242+0200 0x3af211 Info 0x0 55926 0 sourcekit-lsp: [org.swift.sourcekit-lsp:notification-2] clangd token modifier translations (1/1)
2: 4
3: 10
4: 2
5: 3
6: 5
7: 11
8: 12
10: 13
11: 14
12: 15
13: 16
14: 17
15: 18
16: 19
17: 20