MaskRay / vscode-ccls

ccls plugin for Visual Studio Code
123 stars 37 forks source link

CodeLens breaks with the latest ccls. (xref) #9

Closed icylogic closed 5 years ago

icylogic commented 6 years ago

Since CodeLens has changed in the latest commit https://github.com/MaskRay/ccls/commit/8c807685ab1200b404303d2d6954a06ec176cb9c

The result of requesting textDocument/codeLens changed from

screenshot_2018-10-01_01-13-56

to

screenshot_2018-10-01_01-16-00

but I have no idea how to process it.

MaskRay commented 6 years ago

Sorry that I have squashed the commit. It is now https://github.com/MaskRay/ccls/commit/da704521b550606ad0cf3c8dcff8ad2efb54d02e

This is a breaking change.

What ccls did (inherited from cquery):

After the refactoring (the commit you've observed),

https://github.com/maskray/ccls/blob/master/src/messages/textDocument_codeLens.cc#L40

what the server returns now is:

"command":{
  "title":"1 var",
  "command":"ccls.xref",
  "arguments":["{\"usr\":16926293689053220079,\"kind\":2,\"field\":\"instances\"}"]}}

See https://microsoft.github.io/language-server-protocol/specification result: CodeLens[] | null defined as follows:

The Location[] has been replaced with "arguments". When the user clicks the lens button, it sends a workspace/executeCommand request (https://github.com/Microsoft/vscode/blob/c388220ff2ba9953569518d842eb2405b89517bc/src/vs/editor/contrib/codelens/codelensWidget.ts#L96) to the server and the server returns Location[]. This improves the performance a lot.

Slashzer-0 commented 6 years ago

Codelens is still broken. Is a fix for this on the roadmap?

MaskRay commented 6 years ago

Riatre has a fix that diverges from this repository https://github.com/Riatre/vscode-ccls/commit/16690d0c4bb63981950fea070f8f3e5faaec9a10 Someone can pick it up