Implement Semantic Highlighting for SourceKit-LSP

Hi ,
I am Sarthak Dandriyal from India currently pursuing my bachelors of technology with Computer Science and Engineering .
I want to contribute to SourceKit-LSP for implementing semantic highlighting. Can you guide me where do I start?
Thank you,
Sarthak Dandriyal.

Hi @Sarthak_Dandriyal, thanks for your interest!

In order to write a good proposal, I suggest reading about what the proposed semantic highlighting API looks like in LSP, and taking a look at what facilities we already have in Swift/sourcekitd for providing that information.

Proposed LSP API

  • TypeScript description of the proposed API: Unfortunately it doesn't appear to be written up for the specification yet, but the raw API is described at this link.
  • The existing LSP specification, which provides context about how the protocol works, the common types, and how to read the typescript API descriptions.
  • There is also a more detailed description of the proposed VSCode API. This isn't part of LSP itself, but since it appears to be being co-developed, it may still be useful.

Semantic Highlighting in Swift/sourcekitd

Whenever we finish building a new AST in sourcekitd, which happens asynchronously as you edit a file, we send a notification to SourceKit-LSP, which can then make a request for the latest diagnostics and semantic tokens. Currently we only use the diagnostics part of the response, but it also contains the array of semantic tokens.

1 Like
Terms of Service

Privacy Policy

Cookie Policy