Skip to content

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

@FMorschel

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

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