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

Successively disabling and enabling inlay hints doesn't reliably work without typing a character #12027

Closed
x-hgg-x opened this issue Apr 18, 2022 · 13 comments · Fixed by #12171
Closed
Labels
A-inlay-hints inlay/inline hints C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now

Comments

@x-hgg-x
Copy link

x-hgg-x commented Apr 18, 2022

rust-analyzer version: rust-analyzer version: 65fbe0a 2022-04-18 stable

rustc version: rustc 1.60.0 (7737e0b5c 2022-04-04)

relevant settings: Vscode 1.66 on Linux

In the previous version of the extension, I could easily toogle inlay hints with the Rust Analyzer: Toggle inlay hints command.
Now, with the switch to LSP inlay hints, I cannot reenable inlay hints immediately after disabling it, and I need to type a character to "refresh" rust-analyzer.

In the following video, the inlay hints stop working at 0:06, then after I insert a space at 0:10, it works again at 0:12:

out.mp4
@lnicola
Copy link
Member

lnicola commented Apr 19, 2022

I was ready to chalk this off as a Code bug (which is still possible), but the command works in a TypeScript file.

You can also notice how hints flash after being enabled.

@lnicola lnicola added S-actionable Someone could pick this issue up and work on it right now C-bug Category: bug A-inlay-hints inlay/inline hints labels Apr 19, 2022
@SE2Dev

This comment was marked as off-topic.

@lnicola

This comment was marked as off-topic.

@SE2Dev
Copy link

SE2Dev commented Apr 19, 2022

At the time of writing the latest version of the VSCode extension is v0.2.1022 (which was released yesterday). This version still includes rust-analyzer.inlayHints.enable in the settings schema - so it probably should be marked as deprecated, or removed entirely.

It may also be more desirable to change the Toggle inlay hints command to toggle editor.inlayHints.enabled only for Rust (like this), rather than affecting the inlay settings for all languages.

bors added a commit that referenced this issue Apr 20, 2022
fix: Remove `rust-analyzer.inlayHints.enable` and set language scope

Closes #12036
CC #12027 (comment)

The key was left there by mistake in #12006.

Setting the configuration scope only works if you already have it created, which is fine, but unfortunately not quite discoverable.
@lnicola
Copy link
Member

lnicola commented Apr 20, 2022

@SE2Dev see #12037

@villem
Copy link

villem commented Apr 23, 2022

Hi,
The original problem still prevails. Toggling hints back shows hints after a something has been typed. I'm using rust-analyzer version: 1894473 2022-04-23 nightly.

@lnicola
Copy link
Member

lnicola commented May 6, 2022

Not a fix for this, but the new version of Code is more flexible in this regard:

Editor › Inlay Hints: Enabled value:

on - Inlay hints are enabled.
off - Inlay hints are disabled.
onUnlessPressed - Inlay hints shown and hidden with Ctrl+Alt.
offUnlessPressed - Inlay hints hidden and shown with Ctrl+Alt.

@villem
Copy link

villem commented May 6, 2022

The new "OnUlessPressed" mode works perfectly for me. I'm fine if we close this issue.

@lnicola
Copy link
Member

lnicola commented May 6, 2022

I'm worried that this is currently broken anyway, since it toggles between true and false, not on and off.

@villem
Copy link

villem commented May 6, 2022

Yes, vscode preferences editor gave good error about invalid value (true) for inlay hint setting.

@lnicola
Copy link
Member

lnicola commented May 6, 2022

@villem actually, can you try the Toggle inlay hints command? It seems to work fine for me now, even with the old true/false settings (so this bug appears to be fixed).

@lnicola
Copy link
Member

lnicola commented May 6, 2022

Never mind, it works in a test project, but not in a larger one.

@lnicola
Copy link
Member

lnicola commented May 6, 2022

Ah, the dreaded Content Modified strikes again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inlay-hints inlay/inline hints C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants