Skip to content

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

@tigregalis

Description

@tigregalis

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.

Activity

lnicola

lnicola commented on Jan 21, 2020

@lnicola
Member

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

kiljacken commented on Jan 21, 2020

@kiljacken
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

tigregalis commented on Jan 21, 2020

@tigregalis
Author

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

added a commit that references this issue on Apr 20, 2024
added a commit that references this issue on Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @kiljacken@lnicola@tigregalis

        Issue actions

          caret jumps from the second-last character of variable, with type inlay hints · Issue #2888 · rust-lang/rust-analyzer