-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Remove the toggleInlayHints command from VSCode #13215
Conversation
Inlay hints are no longer something specifc to r-a as it has been upstreamed into the LSP, we don't have a reason to give the config for this feature special treatment in regards to toggling. There are plenty of other options out there in the VSCode marketplace to create toggle commands/hotkeys for configurations in general which I believe we should nudge people towards instead.
@bors r+ For the people that used this command, https://marketplace.visualstudio.com/items?itemName=rebornix.toggle allows you to redefine it |
☀️ Test successful - checks-actions |
Remove reference to Toggle inlay hints This simply removes the reference to the `Toggle inlay hints` action after its removal in #13215. In fact, this reference is still visible [in the User Manual here](https://rust-analyzer.github.io/manual.html#inlay-hints).
Install the toggle extension (as mentioned above) and add this (or similar) entry to the {
"key": "shift+alt+x",
"command": "toggle",
"when": "editorTextFocus",
"args": {
"id": "toggle_inlay_hints",
"value": [
{
"editor.inlayHints.enabled": "on"
},
{
"editor.inlayHints.enabled": "off"
}
]
}
} |
Is anyone aware of a way to keep it in the command palette? I'd prefer not to bind this to a keyboard shortcut. In my opinion, it is unfortunate that this was removed without a clear replacement with equivalent functionality. |
Agree with @jhpratt that the removal of this feature is/feels like a regression in my opinion. At least from a usability perspective.... I can relate to the fact that removing this and leveraging a generic mechanism (for configuring inlay hints) leads to better "cleanliness" overall; less non-standard cruft is probably better in many cases... In this case, however, it cost me at least half an hour figuring out why on earth my keybinding wasn't working anymore. I started my VScode to write some code, but instead needed to fiddle with some new 'toggle' extension and creating the right keybindings.json config to go with it... A less-than-stellar experience. I'm otherwise very happy with Rust Analyzer, really an amazing project! I'm very grateful to have such fantastic tooling! 🤗 But these UX-annoyances probably could do with some more overthinking for a users perspective... |
Yes, I can see the problems arising from this, I am sorry for the time waste this may have caused, I assumed VSCode would notify the user if a keybind invokes a command that does not exist. Also, I did not think of the fact that this only has a replacement for the hotkey either. That is, the command can't be re-added in a customizable way because VSCode like usual is way too rigid it seems. I should've done more research here, so again I apologize. I still feel strongly about not having this be part of r-a, for one as outlined in the PR description, this is absolutely not a r-a specific feature, and I'd like the client to write to the user configuration as little as possible, especially non r-a configurations. Now, the hotkey binding does have a replacement (as I have linked one), but the issue of now not having a command to manually call I am not sure what to do about. VSCode doesn't allow to create user facing commands on the fly (they have to be predefined by extensions), so a general purpose solution like the linked hotkey extension is not possible ... I'll have to think about this a bit if there is a replacement for that in some form (aside from making a simple extension that just exposes this one feature). |
For those of us who care about not installing some random closed-source extensions, the suggested "solution" is a no-go, unfortunately. Hopefully a better solution will be available at some point, but until then, this commit effectively removed inline hints for me, since having them on at all times is way too noisy. Edit: seems like the best workaround for now would be to add this into settings: |
This whole "bind key to toggle some config param"-functionality would be a nice core functionality of VScode IMO... Maybe consider positing this as a feature request on the VScode repo? |
If you let go of Alt first after pressing Ctrl + Alt it takes focus away from the text, so you have to click the text again to be able to press Ctrl + Alt in order to show the inlay hints again. This is not a rust-analyzer issue, (should be VSCode issue) but just bringing up another wart on one of the best workarounds we have so far. |
So I just stumbled into this change as well. I am using neovim and coc.nvim which basically tries to mimic VS Code's LSP functionality. Does anyone know how I could get this back? The work-arounds mentioned above seem to be VS Code specific. Edit for others who stumble on this in the future: You want to set |
Hi, just to let people know that an issue got oppen in vscode to make the setting toggleable built in addition of the current options If people can go upvote before December 11, it will move in their backlog. We need 2 more upvotes at least. Here the issue: inlay hints toggle option #163201 Thank you ! |
@GilShoshan94 annoyingly and strangely it was triaged away as "out of scope". I don't really understand that argument. |
@Deebster I know... It's very frustrating the way the vscode team just dismiss and close issues without discussion... I can tell you what I ended up doing: I added the extension Toggle by @rebornix (marketplace, repo). (I found the repo but I don't like that on the marketplace it appears closed source... I guess you can build it from source and add it mannually if you want.) Then in you keybindings.json file I added this: {
// "ctrl+space" does the same already....
"key": "ctrl+i",
"command": "-editor.action.triggerSuggest"
},
{
// "ctrl+space" does the same already....
"key": "ctrl+i",
"command": "-toggleSuggestionDetails"
},
{
"key": "ctrl+i",
"command": "toggle",
"when": "editorTextFocus",
"args": {
"id": "toggleInlayHints",
"value": [
{
"editor.inlayHints.enabled": "on"
},
{
"editor.inlayHints.enabled": "off"
}
]
}
}, And now I can toggle the inlayHints with "ctrl+i" (the first two is to unbind from the default keybind, that's why you see the "-" in front of the command field) I also asked vscode to add this feature (to toggle any setting with keybind) built in microsoft/vscode#166631 but of course they just closed it very quickly.... I am trying to reopen it. I invite you to take a look at this feature request and leave there a comment too fo the vscode team to get it reopen. Have a nice day. |
Yes, why was this removed?? |
// Enables the inlay hints in the editor. |
Inlay hints are no longer something specifc to r-a as it has been upstreamed into the LSP, we don't have a reason to give the config for this feature special treatment in regards to toggling. There are plenty of other options out there in the VSCode marketplace to create toggle commands/hotkeys for configurations in general which I believe we should nudge people towards instead.