internal/lsp: use the correct method name to register semantic tokens

Leave the legacy names to handle old versions of the VS Code language
client.

Updates golang/go#42148

Change-Id: Ia3eeef9e792e502c5c8018698b9c0ea3a9b0dfe5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/266479
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
This commit is contained in:
Rebecca Stambler 2020-10-30 01:00:52 -04:00
parent 2feb2bb1ff
commit 63f8a171a6
1 changed files with 6 additions and 0 deletions

View File

@ -91,9 +91,15 @@ func (s *Server) didChangeConfiguration(ctx context.Context, _ *protocol.DidChan
return nil
}
// This is a work-around for
// https://github.com/microsoft/language-server-protocol/issues/1107. Once
// https://golang.org/cl/266497 has been released for ~1 month, we can probably
// remove this function and use the only correct method name, which is
// "textDocument/semanticTokens".
func semanticTokenRegistrations() []protocol.Registration {
var registrations []protocol.Registration
for _, method := range []string{
"textDocument/semanticTokens",
"textDocument/semanticTokens/full",
"textDocument/semanticTokens/full/delta",
"textDocument/semanticTokens/range",