Skip to content
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

textDocument/linkedEditingRange failed when opening files or moving cursor #1374

Closed
mfru opened this issue Nov 3, 2021 · 16 comments
Closed
Labels
bug Something isn't working lsp

Comments

@mfru
Copy link

mfru commented Nov 3, 2021

Observed behavior: Calva throwing an error, but still working.

Expected behavior: Calva working without throwing errors or printing a more helpful error message.

When opening my Leiningen project in VS Code I get

Request textDocument/linkedEditingRange failed.
  Message: No symbol found
  Code: -32602 

every time I open a .clj file or move the cursor inside a .clj file.

Otherwise it is working fine.

Stacktrace in VS Code DevTools:

 ERR No symbol found: Error: No symbol found
	at /home/mfru/.vscode-server-insiders/extensions/betterthantomorrow.calva-2.0.223/out/extension.js:2:1012761
	at /home/mfru/.vscode-server-insiders/extensions/betterthantomorrow.calva-2.0.223/out/extension.js:2:1013055
	at Immediate.<anonymous> (/home/mfru/.vscode-server-insiders/extensions/betterthantomorrow.calva-2.0.223/out/extension.js:2:1013420)
	at processImmediate (internal/timers.js:461:21)

The last time I remember everything being ok (last time I opened the project) was about a week ago, so maybe a VS Code or Calva update introduced the error?

Calva version: 2.0.223

VS Code Insider version: 
Version: 1.62.0-insider (user setup)
Commit: 4bbec283c36a51cf80f9b77c7a81c140a76a363b
Date: 2021-11-02T08:19:40.220Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19043

Working inside WSL2 with Ubuntu 20.04.3 LTS on Windows 10 x86_64

Leiningen 2.9.3 on Java 11.0.11 OpenJDK 64-Bit Server VM
@mfru
Copy link
Author

mfru commented Nov 3, 2021

I rolled back down to version 2.0.216 of Calva which makes the error go away (everything above doesn't), don't know how that makes sense given the working state of about a week ago, which should have been an already affected version.

It might be related to the issue described in #1373

@bpringe
Copy link
Member

bpringe commented Nov 4, 2021

Thanks for reporting this. It does seem to be related to that issue, in particular to the updating of the LSP client library. textDocument/linkedEditingRange is a LSP request method.

@ericdallo, any idea what could be going wrong here?

@bpringe bpringe added lsp bug Something isn't working labels Nov 4, 2021
@ericdallo
Copy link
Contributor

@bpringe yes, we added on last release the live rename via textDocument/linkedEditingRange but I can't understand why vscode would call it without manual user action...

@ericdallo
Copy link
Contributor

I'd like to understand why vscode calls this method without user interaction, if that makes sense for some reason, we could make clojure-lsp not return error but a null value when not in a symbol

@mfru
Copy link
Author

mfru commented Nov 4, 2021

Are you able to reproduce the error as is? If not I'll try to find a minimal reproduction setup.

Until then steps to reproduce should be

  1. Have VSCode 1.62.0-insider with Calva 2.0.217 - 2.0.223 installed
  2. Open a Leiningen project (maybe a single .clj file suffices as well)

@ericdallo
Copy link
Contributor

ericdallo commented Nov 4, 2021

I can't repro that with a lein project and calva 2.0.222, but I'm using vscode 1.60.2 but I doubt it could be related

@mfru
Copy link
Author

mfru commented Nov 4, 2021

Tried to repro with the portable version of VSCode 1.62.0 with Calva 2.0.223 but it throws no error.

Will have to be an individual issue on my existing setup then.

I'll let you know if I find anything out.

@bpringe
Copy link
Member

bpringe commented Nov 6, 2021

To provide another data point, I tried to reproduce as well with Calva 2.0.223 and VS Code Insiders 1.63.0 as well as VS Code 1.62.0 and could not.

@gAdrev
Copy link

gAdrev commented Nov 10, 2021

I am also getting this with:

  • VS Code 1.62.1
  • All extensions disabled except for Calva
  • Calva 2.0.223
  • OS: Linux, deb vscode repo install (Ubuntu 20.04)
  • Open a folder consisting of a single deps.edn file with contents: {}

Just opening the deps.edn file makes the toast appear.

The extension log reads this for each toast:

[2021-11-10 01:12:04.501] [exthost] [error] [betterthantomorrow.calva] provider FAILED
[2021-11-10 01:12:04.502] [exthost] [error] Error: No symbol found
	at /home/javier/.vscode/extensions/betterthantomorrow.calva-2.0.223/out/extension.js:2:1012761
	at /home/javier/.vscode/extensions/betterthantomorrow.calva-2.0.223/out/extension.js:2:1013055
	at Immediate.<anonymous> (/home/javier/.vscode/extensions/betterthantomorrow.calva-2.0.223/out/extension.js:2:1013420)
	at processImmediate (internal/timers.js:461:21)

As @mfru said, downgrading to 2.0.216 makes the error go away. Anything starting from 2.0.217 or newer up to current 2.0.223 produces the error.

@gAdrev
Copy link

gAdrev commented Nov 10, 2021

Also, testing with VSCode Insiders 1.63.0 (deb packaged) produces the same error with the newer versions of Calva.

@ericdallo
Copy link
Contributor

ericdallo commented Nov 10, 2021

thanks for the feedback, this still stands for me: #1374 (comment)
The worst case calva could disable that linkedEditingRange feature manually

@bpringe
Copy link
Member

bpringe commented Nov 10, 2021

This search might be a good place to start. This only started happening after vscode-languageclient was updated in this PR.

I only looked briefly in that vsode-languageserver-node repo (which includes the client library), and I didn't see anything pointing to it being called by the client, but further inspection might yield useful info.

One other thing that I suppose could be happening is that something Calva or VS Code are calling causes that request to be made when the 7.0.0+ version of the client is available. I don't know if that makes sense though.

@bpringe bpringe closed this as completed Nov 10, 2021
@bpringe bpringe reopened this Nov 10, 2021
@bpringe
Copy link
Member

bpringe commented Nov 10, 2021

Accidentally closed 😄

@ericdallo
Copy link
Contributor

One other thing that I suppose could be happening is that something Calva or VS Code are calling causes that request to be made when the 7.0.0+ version of the client is available. I don't know if that makes sense though.

I really think this is true, calva started calling after the version was upgraded + clojure-lsp added support to linkedEdittingRange on latest release

@bpringe
Copy link
Member

bpringe commented Nov 19, 2021

Adding some info from Eric in Slack:

I think there is a quickfix here of force disabling linkedEdittingRange on calva side
Maybe forcing to not send that capability when initializing server

This probably wouldn't take long to fix. I'll prioritize it, but it might be a bit before I get to it. A PR is welcome if anyone feels the desire to do it before me.

@bpringe
Copy link
Member

bpringe commented Nov 20, 2021

From Rick Jensen on Slack:

Interestingly enough, my machine crashed and after rebooting the problem seems to have gone away. Not sure if something updated behind the scenes or it is due to a race condition, but I’m no longer experiencing the buggy behavior I was before.

I'm not sure why it would stop happening like that, but I wanted to add the additional info here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp
Projects
None yet
Development

No branches or pull requests

4 participants