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

New assist - inline if with outer else #56924

Closed
FMorschel opened this issue Oct 20, 2024 · 2 comments
Closed

New assist - inline if with outer else #56924

FMorschel opened this issue Oct 20, 2024 · 2 comments
Labels
analyzer-assist Issues with analysis server assists area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@FMorschel
Copy link
Contributor

Could we add the option to join inner if with else:

if (a) {
} else {
  if (b) {
  } else if (c) {
  }
}

Could become:

if (a) {
} else if (b) {
} else if (c) {
}

Originally posted by @FMorschel in #56715 (comment)

I made a CL https://dart-review.googlesource.com/c/sdk/+/391021

@dart-github-bot
Copy link
Collaborator

Summary: The user proposes adding an assist to the Dart editor that automatically combines nested if statements with an outer else into a single chain of else if statements. This would simplify code structure and improve readability.

@dart-github-bot dart-github-bot added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. 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 20, 2024
@scheglov
Copy link
Contributor

Look useful to me!

@keertip keertip added analyzer-assist Issues with analysis server assists P3 A lower priority bug or feature request labels Oct 22, 2024
@lrhn lrhn removed the triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-assist Issues with analysis server assists area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. 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

5 participants