Skip to content

feature request: text edits for bind_pat inlay hints. #13812

Open
@jhgg

Description

@jhgg

Inlay hints can have text edits which can be provided to "apply" the inlay hint when double clicked on. I noticed this recently in the python language server's inlay hints, that I could do:

image

We could provide text edits which would auto-import any type that is referred to, and insert the type annotation, where syntactically valid.

For example:

fn foo() {
   let eligible = "hello".starts_with(|c| c.is_uppercase());
   //         ^ `: bool `              ^ `: char`
   match Some(eligible) {
        Some(n) => { }
        //   ^ not eligible, because inserting `: bool` here would not be valid syntax.
        None => { }
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions