Skip to content

Show inferred types as inline code #4154

@gaaclarke

Description

@gaaclarke

I've been writing some Rust code and I've appreciated the inline declarations of inferred types. It makes reading and working with code much easier. This is apropos Dart where some repositories enforce the explicit declaration of types whereas others don't.

Here is an example of the Rust extension showing inferred types (and parameter names but this issue isn't asking for that):
Screen Shot 2022-09-09 at 11 13 57 AM

: &Option<Rc<Node<i32>>> is the inferred type of result. It doesn't exist in the file but it would be valid code had it been written there. The inline hint is itself valid code, which is important.

So in Dart's case it would look like this:

final x = add(1, 2);

becomes:

final int x = add(1, 2);

Where int doesn't exist in the code but is displayed as above as if it was.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris enhancementrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions