-
Notifications
You must be signed in to change notification settings - Fork 340
Show inferred types as inline code #4154
Copy link
Copy link
Closed
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serverSomething to be fixed in the Dart analysis serveris enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.An enhancement or improvement that should be listed in release notes but is not a bug fix.relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become availableSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone
Metadata
Metadata
Assignees
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serverSomething to be fixed in the Dart analysis serveris enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.An enhancement or improvement that should be listed in release notes but is not a bug fix.relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become availableSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
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):

: &Option<Rc<Node<i32>>>is the inferred type ofresult. 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:
becomes:
Where
intdoesn't exist in the code but is displayed as above as if it was.