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

Cursor position is pretty weird in inlay hints #1623

Closed
davyzhang opened this issue Jul 29, 2019 · 9 comments
Closed

Cursor position is pretty weird in inlay hints #1623

davyzhang opened this issue Jul 29, 2019 · 9 comments

Comments

@davyzhang
Copy link

davyzhang commented Jul 29, 2019

I actually place it after p so it should look like p|, instead, it was placed after the whole inlay hints.
If I type something, it correctly put the characters behind "p" though.
In this case, it is trivial.
image

But if the inlay hints are long, this would be awkward to handle. See the demo below
image

@killercup
Copy link
Member

I guess this is a VSCode constraint, especially since decorations aren't really meant to be used like this. An easy way to make this a bit better might be to shorten the max length of inlay hints, i.e. showing just RootNode<…> in your second case. Not sure if people will like this trade-off, though.

@SomeoneToIgnore
Copy link
Contributor

That will remain as is for now, unfortunately.

Here's a VS Code issue about true parameter hints support: microsoft/vscode#16221

@matklad
Copy link
Member

matklad commented Jul 30, 2019

What we might want to try is attaching the decoration before the following token, and not after the binding. Not sure if it's a good idea though.

@killercup
Copy link
Member

killercup commented Jul 30, 2019

inb4

let really_long_identifier_that_is_very_descriptive
    = "but it also like to have my equal signs on the next line";

Edit: Fine, @matklad wins

@matklad
Copy link
Member

matklad commented Jul 30, 2019

@killercup the next token here is whitespace ;)

@p-avital
Copy link

p-avital commented Jul 30, 2019

What we might want to try is attaching the decoration before the following token, and not after the binding. Not sure if it's a good idea though.

I think I've tried that on the rls-vscode client, and the cursor still insists on going to the right of the decoration. Might be wrong though, so do check it, should be a quick enough hack to try :)

Also, keeping the decoration tied to the variable name makes hovering over the hint behave the same as Hovering over the variable, which is more convenient and might be used to show a more detailed type hint (without the abridgements for example)

@matklad
Copy link
Member

matklad commented Jul 30, 2019

Thanks for the input @p-avital

Closing as an upstream issue then!

Just a reminder, it's possible to completely disable hints in the settings

@corneliusroemer
Copy link

corneliusroemer commented May 6, 2022

I think the rust-analyzer extension has switched to using native type hints recently. So maybe some of these issues can now be addressed?
See #2797, #11445

@Veykril
Copy link
Member

Veykril commented May 6, 2022

This is still a client side issue with VSCode, not something r-a has control over

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants