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

caret jumps from the second-last character of variable, with type inlay hints #2888

Closed
tigregalis opened this issue Jan 21, 2020 · 3 comments

Comments

@tigregalis
Copy link

tigregalis commented Jan 21, 2020

Apologies for the messy issue title. Not sure how to phrase it. Example below applies to VS Code.

type-inlay-hint-issue

With type inlay hints, when moving the caret, it jumps from between the second-last and last characters ([len-1, len]) of the variable name to the end of the inlay hint. That is, the caret never falls after the end of the variable name on the last character ([len, len+1]).

This is unintuitive. It would be more appropriate to have the type inlay hint "occupy" the whitespace afterwards instead.

The parameter inlay hint appears to behave intuitively.

@lnicola
Copy link
Member

lnicola commented Jan 21, 2020

See #1623 and #1651. It's the way Code works, and we probably can't fix it. There are plans for a type hint API, but it's not being worked on, as far as I know.

@kiljacken
Copy link
Contributor

The parameter inlay hint has the same theoretical issue, but seems better because it is a prefix instead of a suffix. We talked about it when we initially implemented the features and I think it's an inherent limit with what VSCode allows us to do the the editor. Unless something has changed since then, we can't really do anything about it.
Going to close it, hope you don't mind.

@tigregalis
Copy link
Author

Ah alright. Thanks for the response. I should have checked closed issues. Feel free to close it.

RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 20, 2024
TB diagnostics: avoid printing irrelevant events

History contains some events that are relevant to the location but not useful to understand the error.
We can make the selection of events more precise, from only "does it affect the location" to also "is it relevant for this kind of error"

This is also the occasion to fix rust-lang/miri#2867 (comment)

[Solved] Draft: find a way for blanks in the history to not be confusing, as with the current version the history can show the creation as `Reserved` then show where it transitioned from `Frozen` to `Disabled`, but it will say nothing of the `Reserved -> Frozen` leading up to it.
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 27, 2024
TB diagnostics: avoid printing irrelevant events

History contains some events that are relevant to the location but not useful to understand the error.
We can make the selection of events more precise, from only "does it affect the location" to also "is it relevant for this kind of error"

This is also the occasion to fix rust-lang/miri#2867 (comment)

[Solved] Draft: find a way for blanks in the history to not be confusing, as with the current version the history can show the creation as `Reserved` then show where it transitioned from `Frozen` to `Disabled`, but it will say nothing of the `Reserved -> Frozen` leading up to it.
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

3 participants