Skip to content

Assist to make parameter into named #56855

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

Closed
FMorschel opened this issue Oct 4, 2024 · 5 comments
Closed

Assist to make parameter into named #56855

FMorschel opened this issue Oct 4, 2024 · 5 comments
Labels
legacy-area-analyzer Use area-devexp instead. type-enhancement A request for a change that isn't a bug

Comments

@FMorschel
Copy link
Contributor

Inspired by #53707

Today if you add a new final field to a class that already has a constructor you only have the option to add it to the constructor as an (unnamed) positional parameter.

image

I'd like an assist to toggle between named, unnamed and positional parameter types.

@dart-github-bot
Copy link
Collaborator

Summary: The user requests a feature to toggle between named, unnamed, and positional parameter types when adding a new final field to a class with an existing constructor. This would provide more flexibility and control over parameter types.

@dart-github-bot dart-github-bot added legacy-area-analyzer Use area-devexp instead. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-enhancement A request for a change that isn't a bug labels Oct 4, 2024
@lrhn lrhn removed the triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. label Oct 4, 2024
@bwilkerson
Copy link
Member

We have a refactoring that will do this for you. It's currently marked as experimental, which means that you have to set a flag somewhere in order to have it show up in VS Code (I've forgotten where the flag is but @DanTup will probably remember).

@DanTup
Copy link
Collaborator

DanTup commented Oct 7, 2024

The setting to enable experimental refactors is:

"dart.experimentalRefactors": true,

And with it, I see these:

params_to_named.mp4

@FMorschel
Copy link
Contributor Author

FMorschel commented Oct 7, 2024

I've tested it and it does seem to work. Some final questions:

  1. Is there an issue for it that I can follow?
  2. Will it have the other options as well (optional positional and going back to unnamed)?
  3. Why is it still experimental (what criteria is this trying to meet)?
  4. Should I close this?

Edit

One thing I noticed was that it also doesn't tell the user about the progress in the refactor just as Dart-Code/Dart-Code#5235.

@bwilkerson
Copy link
Member

  1. Is there an issue for it that I can follow?

#45675 (but I'll note that we're notoriously bad at remembering to go back and close and issue when a feature ships, so it's not clear whether there will be anything to follow).

  1. Will it have the other options as well (optional positional and going back to unnamed)?

That's the goal, but it's been a while since we've been able to work on it, so I can't give you a timeframe.

  1. Why is it still experimental (what criteria is this trying to meet)?

We thought it needed more testing.

  1. Should I close this?

Yes, I think this is a duplication.

... progress in the refactor ...

Agreed, we should probably have some kind of progress notification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants