-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Language Server Syntax Highlights #1985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Language Server Syntax Highlights #1985
Conversation
…ecoolwinter/CodeEdit into feat/lsp-semantic-highlighter
This is officially ready for review with passing tests! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really nice! I do have some questions—some are just out of personal interest
CodeEdit/Features/LSP/LanguageServer/Capabilities/LanguageServer+DocumentSync.swift
Show resolved
Hide resolved
CodeEdit/Features/LSP/LanguageServer/Capabilities/LanguageServer+SemanticTokens.swift
Outdated
Show resolved
Hide resolved
CodeEdit/Features/LSP/LanguageServer/Capabilities/LanguageServer+SemanticTokens.swift
Outdated
Show resolved
Hide resolved
CodeEdit/Features/LSP/LanguageServer/Capabilities/LanguageServer+SemanticTokens.swift
Outdated
Show resolved
Hide resolved
Looks good, will approve after the comments are resolved |
Failing test is due to a bug in CETV that's fixed with this PR. This should be good to merge and would be great to get done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been open for a while and seeing as @FastestMolasses's only concern has been fixed, it shouldn't be a problem to merge. Lets move forward. ⏩ I did give it a quick look and it looks good from what I can tell. 👍
Description
Adds semantic token syntax highlighting to the code file view.
When an LSP is installed and configured for a language type, and has semantic highlights support, CodeEdit will install a new highlight provider on the source editor and begin processing syntax tokens for the file.
Token processing happens asynchronously, and does not replace tree-sitter highlights. This builds off recent work in the source editor to support a hierarchy of highlight providers. Language server highlights are slow but more accurate, so we process them slowly and apply them when they become available.
Details
CodeFileDocument
, it'll be a matter of conforming the new type to the protocol for it to work with the lsp code.SemanticTokenHighlightProvider
typeHighlightProviding
protocol.SemanticTokenMap
typeSemanticTokenStorage
Related Issues
Checklist
Screenshots
Live editing demo, note the highlights on the variable types and switch cases.
CodeEdit.mp4