Skip to content

Inlay hints multiply when using VSCode action "Rust Analyzer: Restart server" #12836

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

Closed
Heinenen opened this issue Jul 20, 2022 · 19 comments · Fixed by #12847
Closed

Inlay hints multiply when using VSCode action "Rust Analyzer: Restart server" #12836

Heinenen opened this issue Jul 20, 2022 · 19 comments · Fixed by #12847
Labels
A-vscode vscode plugin issues Broken Window Bugs / technical debt to be addressed immediately

Comments

@Heinenen
Copy link
Contributor

While writing some rust, I restarted the language server with the "Rust Analyzer: Restart server" action and encountered a bug.
My "workflow" to reproduce:

  1. Restart r-a server
  2. Comment out a line
  3. Save file
  4. Uncomment same line

The bug is reproducible for me 100% of the time, even when I wait longer after restarting the language server.
Restarting the server multiple times increases the number of inlay hints multiple times (also seen in gif).

inlay_hints2

rust-analyzer version: 0.4.1132-standalone (567a5e9 2022-07-18)

rustc version: rustc 1.62.0 (a8314ef7d 2022-06-27)

PS: When using the "Developer: Reload window" action, the inlay hints don't show up at all unless I change something in the file (with or without saving it). If you think that is worth another issue, I can file one for that as well.

@leighmcculloch
Copy link

leighmcculloch commented Jul 22, 2022

I am experiencing the same thing with auto-completion, hovers, and other things. Duplicate items start being displayed. For example:

Screen Shot 2022-07-21 at 10 46 38 PM

Screen Shot 2022-07-21 at 10 46 53 PM

@ilyvion
Copy link

ilyvion commented Jul 22, 2022

I'll chime in and say that I'm also experiencing this. It's like "restart" behaves more like "start another."

@Veykril
Copy link
Member

Veykril commented Jul 22, 2022

odd, I can't reproduce this at all, not the duplication of inlay hints, nor inlay hints not appearing after a reload until i change the file ...

@tklajnscek
Copy link

+1 also had this happen to me recently, but only once and I couldn't make it happen again so I didn't report yet

@Heinenen
Copy link
Contributor Author

I am also experiencing the same issues as @leighmcculloch, I just didn't notice it.
Another thing that appears multiple times is the outline and "Go to Symbol in Editor (Ctrl + Shift + o)"
If it helps, I am using Manjaro KDE with the open source build of VSCode.

@lnicola
Copy link
Member

lnicola commented Jul 22, 2022

Just to make sure, how did you install the extension? Actually, what extensions do you have installed?

@leighmcculloch
Copy link

I didn't install rust-analyzer manually. It was installed via the vscode extension.

@lnicola
Copy link
Member

lnicola commented Jul 22, 2022

How did you install the extension?

@Heinenen seems to have a recent build, at least of the server binary.

@Veykril Veykril added the Broken Window Bugs / technical debt to be addressed immediately label Jul 22, 2022
@jonathanpallant
Copy link
Contributor

jonathanpallant commented Jul 22, 2022

I see this on macOS for Arm and VS Code 1.69.2 (although I ssh into an x86 Debian machine).

@Veykril Veykril added the A-vscode vscode plugin issues label Jul 22, 2022
@Veykril
Copy link
Member

Veykril commented Jul 22, 2022

This is very odd, I'm on VSCode 1.69.2, windows and cannot reproduce it with the latest server. When executing the Restart Server command do the inlay hints stay and a new set appears once restarted, or do the hints disappear and then re-appear duplicated?

@lnicola
Copy link
Member

lnicola commented Jul 22, 2022

although I ssh into an x86 Debian machine

Note that RA runs on the remote side. You should check the version number(s), just in case.

@leighmcculloch
Copy link

leighmcculloch commented Jul 22, 2022

I am on VSCode 1.69.2, but I've seen this behavior on previous versions too.

I switch back and forth between the release and pre-release versions of rust-analyzer, and I'm not 100% confident, but I think I'm only seeing this on the pre-release version of the extension, v0.4.1136. I don't see this behavior on the latest release version of the extension, v.0.3.1131.

@Heinenen
Copy link
Contributor Author

I installed my extension by downloading the .vsix from the marketplace and then installing it inside the Extensions tab inside vscode.
I have VSCode 1.69.2 aswell (for linux)

@Heinenen
Copy link
Contributor Author

And I just disabled all the other extension and the bug persists.

@tklajnscek
Copy link

I am also on arm64 Mac, VSCode 1.69.2, extension v0.3.1131 installed from the marketplace

@Heinenen
Copy link
Contributor Author

I installed rust-analyzer on my windows machine and both bugs appear there as well.

When executing the Restart Server command do the inlay hints stay and a new set appears once restarted, or do the hints disappear and then re-appear duplicated?

One layer of inlay hints disappears and re-appears duplicated (so when restarting for the first time all inlay hints disappear and reappear duplicated). When there are multiple layers of inlay hints, only the "last" layer disappears and is duplicated, the other layers stay. I think the gif I posted shows this behavior too.

@Veykril
Copy link
Member

Veykril commented Jul 22, 2022

Okay, so I can't reliable produce it but I do get it sometimes, from the looks of it all requests are being duplicated by the client

Looks like we end up with two server instances that we serve huh

@Veykril
Copy link
Member

Veykril commented Jul 22, 2022

Okay, so restarting the server while its currently loading the workspace causes this, managed to duplicate it multiple times now
image

And now I can't reproduce it anymore...

@Veykril
Copy link
Member

Veykril commented Jul 22, 2022

so, restarting the server, then changing a file (and saving it, this is the important part) revives the old deactivated client, and the vscode changelogs reveal why

if an extension sends a notification or request before the client got started the client will auto start.

Now that was a pain to debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vscode vscode plugin issues Broken Window Bugs / technical debt to be addressed immediately
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants