-
Notifications
You must be signed in to change notification settings - Fork 260
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
First attempt to include the semantic highlight feature, introduced in specification 3.16.0. #740
base: master
Are you sure you want to change the base?
Conversation
…n specification 3.16.0.
Thanks! I guess the specification is probably a bit unfortunate, since the payload may be much larger than the ccls extension... |
I've been using this branch today and it looks like it works all right (at least, for starters… I didn't see any obvious errors or problems) @MaskRay is there any documentation of how to handle the missing |
94ba2b3
to
c018bce
Compare
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.
Do you know which client can be used for testing? It seems that semantic tokens do not support rainbow semantic highlighting?
@@ -25,6 +25,47 @@ | |||
namespace ccls { | |||
using namespace llvm; | |||
|
|||
std::vector<const char *> SEMANTIC_TOKENS = { |
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.
const char *SEMANTIC_TOKENS[] =
@@ -0,0 +1,257 @@ | |||
// Copyright 2017-2020 ccls Authors |
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.
Omit year number // Copyright ccls Authors
|
||
} | ||
|
||
void MessageHandler::textDocument_semanticTokensFull( |
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 replicates too many lines in message_handler.cc
. You can make the message_handler.cc
implementation public and call that function.
db890d4
to
cc13ced
Compare
This is a crude attempt to include semantic highlights introduced in LSP spec 3.16.0:
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens
It is mostly copied src/message_handler.cc#emitSemanticHighlight, with some tweaks. Feedback is welcome!