Skip to content

Missing inline value for object/record pattern and for loops #5547

Closed

Description

@FMorschel

Is your feature request related to a problem? Please describe.
Inline values show for parameters but not for pattern destruction blocks. This forces me to hover the assigned variable instead of simply looking at the value.

Describe the solution you'd like
When destructing the record (repro below) into x and y, and always in for loops, we should see the new declared/assigned variable value.

Describe alternatives you've considered
Hovering over the variable or adding to watch.

Additional context

Repro:

class A {
  List<int> list = [1, 2, 3];

  void m(int value, List<(int, int)> records) {
    for (var x in list) { // B1 here, all parameters show
      print(value);  // B2 here, same as above
      print(x);
    }
    for (var (x, y) in records) {
      print(value); // B3 here, since the iterable above is not a getter, we see its value being used too
      x + y;
    }
  }
}

void main() {
  A().m(0, [(1, 2)]);
}

Image

Image

Image

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Jun 13, 2025
  2. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    on Jun 16, 2025
  3. added this to the v3.114.0 milestone on Jun 16, 2025
  4. DanTup commented on Jun 16, 2025

    @DanTup
    Member

    https://dart-review.googlesource.com/c/sdk/+/434860 fixes the for loop identifiers and destructured variables, though I've opened #5550 separately about list (the class getter) not showing up, since it seems we're missing getters in a few places.

  5. DanTup commented on Jun 16, 2025

    @DanTup
    Member
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

    in editorRelates to code editing or language featuresin lsp/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.relies 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