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

Option idea for rule wrapMultilineConditionalAssignment #1641

Open
smartpie opened this issue Mar 13, 2024 · 0 comments
Open

Option idea for rule wrapMultilineConditionalAssignment #1641

smartpie opened this issue Mar 13, 2024 · 0 comments

Comments

@smartpie
Copy link

It would be helpful to have an option for rule wrapMultilineConditionalAssignment, so that it only works if the line length exceeds --maxwidth.

For example, our --maxwidth 100 if we have something like this

let state: CameraControlsUpperItem.State = if case .preview = previousState.screen, stage == .beforeAnimation {
  .preAnimation
} else {
  .normal
}

It will be formatted to:

let state: CameraControlsUpperItem.State =
  if case .preview = previousState.screen,
  stage == .beforeAnimation {
    .preAnimation
  } else {
    .normal
  }

But if we have:

let state: CameraControlsUpperItem.State = if case .preview = previousState.screen {
  .preAnimation
} else {
  .normal
}

It will remain the same, because line length is less than 100

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

No branches or pull requests

1 participant