swiftlang / sourcekit-lsp

Language Server Protocol implementation for Swift and C-based languages
Apache License 2.0
3.2k stars 264 forks source link

Translate the semantic token legend used by clangd to the semantic token legend used by SourceKit-LSP #1510

Closed ahoppen closed 1 week ago

ahoppen commented 1 week ago

clangd uses a completely different semantic token legend than SourceKit-LSP (it doesn’t even adhere to the ordering of the pre-defined token types) but we were passing index offsets from clangd through assuming that clangd uses the same legend, which was incorrect.

When retrieving semantic tokens from clangd, translate the semantic tokens from clangd’s legend to SourceKit-LSP’s legend.

rdar://129895062

ahoppen commented 1 week ago

@swift-ci Please test