Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"find all references" on initializing formals only finds references to the field, not the constructor parameter #4649

Closed
Dieterbe opened this issue Jul 18, 2023 · 2 comments

Comments

@Dieterbe
Copy link

Hello!
Consider this code:

void main() {
  runApp(const MyApp());
  final p1 = Point(x: 1, y: 2);
  final p2 = Point2(x: 1, y: 2);
}

class Point {
  Point({num? x, num? y}) {
    this.x = x;
    this.y = y;
  }
  num? x, y;
}

class Point2 {
  Point2({this.x, this.y});
  num? x, y;
}

When you, find all references on the 'x' constructor parameter of class Point, you find the line where p1 is being created inside of main(). this is desired.

image

However, when you use the "initializing formals" syntax, which is promoted by the plugin, and you find all references on the 'x' constructor parameter of the Point2 class, you no longer get the line where p2 is being created inside main(). You only see references to where the field is being used inside the class. This seems like a problem. See screenshot:

image

  • Operating System and version: arch linux (latest updates)
  • VS Code version: 1.79.2
  • Dart extension: Dart Code extension: 3.68.1, Flutter extension: 3.68.0 (not activated)
  • Dart SDK version: 3.0.5 (stable) (Mon Jun 12 18:31:49 2023 +0000) on "linux_x64"
  • Flutter 3.10.5 • channel stable • ssh://git@github.com/flutter/flutter.git

Thank you for your consideration, and for a pretty great experience overall!

@DanTup
Copy link
Member

DanTup commented Jul 19, 2023

Thanks for the report. This came up previously in #4535 and has been fixed. The fixed is in the language server, so it'll show up in a future Dart/Flutter SDK release.

image

Thanks!

@DanTup DanTup closed this as completed Jul 19, 2023
@DanTup DanTup added duplicate and removed is bug labels Jul 19, 2023
@Dieterbe
Copy link
Author

Cheers @DanTup have a great day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants