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

FormatWriter: implement align.delayUntilSpace #3616

Merged
merged 2 commits into from
Aug 21, 2023

Conversation

kitbellew
Copy link
Collaborator

Fixes #3614.

@kitbellew kitbellew requested a review from tgodzik August 18, 2023 18:10
@treetime
Copy link

treetime commented Aug 20, 2023

Should this interact with Align.multiline?
For

spaces.inParentheses = false
align.delayUntilSpace = false
align.tokens."+" = [ { code = ":" }, { code = "(" }, { code = ")" }, { code = "=" } ]

Given:

object potato {
   def meeethod1(pram1:   AnyRef): Any = ???

   def methd2(paaaaaram2: Any):    Any = ???
   def meth3(param33333:  Any):    Any = ???
   def md4(param4:        Any):    Any = ???
}

yields:

object potato {
  def meeethod1(pram1: AnyRef): Any = ???

  def methd2(paaaaaram2: Any): Any = ???
  def meth3 (param33333: Any): Any = ???
  def md4   (param4    : Any): Any = ???
}

Adding align.multiline=true yields the same; I would've expected alignment to happen despite the newline.

@kitbellew
Copy link
Collaborator Author

Should this interact with Align.multiline? For

this is orthogonal to multiline; also, in your example, none of the expressions are occupying multiple lines.

keep in mind that alignment applies to successive lines only, and there's a blank line, the current alignment block is flushed.

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

def md4(param4: Any): Any = ???
}
>>>
object a {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I would have thought it would work like this always with alignment, though I don't use so never tested. I guess since this changes the default, we need the additional flag.

@kitbellew kitbellew merged commit 4c1d272 into scalameta:master Aug 21, 2023
8 checks passed
@kitbellew kitbellew deleted the 3614 branch August 21, 2023 14:24
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

Successfully merging this pull request may close these issues.

Tabular Alignment
3 participants