Skip to content

"Find all references" does not treat field formal parameters as references to fields #4868

@lukehutch

Description

@lukehutch

Describe the bug

"Find all references" seems to discriminate between this. parameters and the fields they map to. I don't think there should be a distinction.

To Reproduce

Create these two classes:

class X {
  int x;  // (1)
  X({required this.x});  // (2)
}

class Y {
  void foo() {
    X(x: 1);  // (3)
  }
}

Actual behavior

The numbers (1), (2), and (3) infer positioning the cursor at x on the correspondingly numbered line, and then right-clicking and selecting "Find all references":

  • "Find all references" at (1) finds only (1) and (2).
  • "Find all references" at (2) finds only (1) and (3).
  • "Find all references" at (3) finds only (2) and (3).

Expected behavior

"Find all references" at any of (1), (2), or (3) should find all three.

(Dart 3.3.0 on Linux)

Metadata

Metadata

Assignees

No one assigned

    Labels

    in lsp/analysis serverSomething to be fixed in the Dart analysis serveris bugrelies 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