Skip to content

Quick Assist for super in extension methods #45821

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

Open
ChristianKleineidam opened this issue Apr 25, 2021 · 2 comments
Open

Quick Assist for super in extension methods #45821

ChristianKleineidam opened this issue Apr 25, 2021 · 2 comments
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-quick-fix Issues with analysis server (quick) fixes P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@ChristianKleineidam
Copy link

It frequently happens that I add another final variable to a class like:

class Foo{
  final String a;
  final String b;

  Foo(this.a);
}

In this case I helpfully get a quick assist to create:

class Foo {
  final String a;
  final String b;

  Foo(this.a, this.b);
}

If I however also have an extension class, I have an error as super only provides a and not b.

class Moo extends Foo {
  Moo(String a) : super(a);
}

In this case I have an error but currently no Quick Assist. It would be helpful to have a quick assist that creates:

class Moo extends Foo {
  Moo(String a, String b) : super(a, b);
}
@lrhn lrhn added legacy-area-analyzer Use area-devexp instead. type-enhancement A request for a change that isn't a bug labels Apr 26, 2021
@lrhn
Copy link
Member

lrhn commented Apr 26, 2021

Sounds like a general case where, if a subclass constructor doesn't forward all necessary parameters to the superclass constructor, a quick-fix could add an extra required parameter and forward it to the super-class. Could make the parameter named if it's named in the superclass and the subclass doesn't already have optional positional parameters.

@bwilkerson
Copy link
Member

For future reference, the diagnostic code being produced here is not_enough_positional_arguments.

@srawlins srawlins added devexp-quick-fix Issues with analysis server (quick) fixes P3 A lower priority bug or feature request labels Jul 20, 2021
@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed legacy-area-analyzer Use area-devexp instead. labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-quick-fix Issues with analysis server (quick) fixes P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants