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

wrap long list extractors #408

Closed
easel opened this Issue Aug 21, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@easel
Contributor

easel commented Aug 21, 2016

I would like long list extractors to respect the maximum line length, or at least respect my original formatting.

Original:

      case accountIdStr :: userIdStr :: connectorIdStr :: timestampStr :: eventClassStr :: contactIdStr
        :: contactPointIdStr :: contactPointValue :: remoteContactId :: to :: subject :: remoteId
        :: remoteGroupId :: timeZoneStr :: rest 

Scalafmt:

      case accountIdStr :: userIdStr :: connectorIdStr :: timestampStr :: eventClassStr :: contactIdStr :: contactPointIdStr :: contactPointValue :: remoteContactId :: to :: subject :: remoteId :: remoteGroupId :: timeZoneStr :: rest 

I would like the output to look like this:

      case accountIdStr :: userIdStr :: connectorIdStr :: timestampStr :: eventClassStr :: contactIdStr
        :: contactPointIdStr :: contactPointValue :: remoteContactId :: to :: subject :: remoteId
        :: remoteGroupId :: timeZoneStr :: rest 

Using:

  • 0.2.x
  • --style defaultWithAlign
  • --rewriteTokens =>;⇒,<-;←
  • --maxColumn 112
  • --assumeStandardLibraryStripMargin true
  • --continuationIndentCallSite 2

@olafurpg olafurpg self-assigned this Aug 22, 2016

@olafurpg

This comment has been minimized.

Show comment
Hide comment
@olafurpg

olafurpg Aug 22, 2016

Member

Good catch. Scalafmt should preserve line breaking choices for infix pattern extractors just like it does for infix applications. The output will look like this now

  case accountIdStr :: userIdStr :: connectorIdStr :: timestampStr :: eventClassStr :: contactIdStr
        :: contactPointIdStr :: contactPointValue :: remoteContactId :: to :: subject :: remoteId
          :: remoteGroupId :: timeZoneStr :: rest =>

Since 0.2.6, scalafmt does not line wrap around infix operators because it breaks too many fancy DSLs. You choose the line breaks.

Member

olafurpg commented Aug 22, 2016

Good catch. Scalafmt should preserve line breaking choices for infix pattern extractors just like it does for infix applications. The output will look like this now

  case accountIdStr :: userIdStr :: connectorIdStr :: timestampStr :: eventClassStr :: contactIdStr
        :: contactPointIdStr :: contactPointValue :: remoteContactId :: to :: subject :: remoteId
          :: remoteGroupId :: timeZoneStr :: rest =>

Since 0.2.6, scalafmt does not line wrap around infix operators because it breaks too many fancy DSLs. You choose the line breaks.

@olafurpg olafurpg closed this in 75ce79d Aug 22, 2016

olafurpg added a commit that referenced this issue Aug 22, 2016

Merge pull request #409 from olafurpg/408
Treat Pat.ExtractInfix like Term.ApplyInfix. Fixes #408

@olafurpg olafurpg removed the in progress label Aug 22, 2016

@olafurpg

This comment has been minimized.

Show comment
Hide comment
@olafurpg

olafurpg Aug 22, 2016

Member

I'll try to release this asap, would like to fix #405 first.

Member

olafurpg commented Aug 22, 2016

I'll try to release this asap, would like to fix #405 first.

@olafurpg olafurpg added the bug label Aug 24, 2016

@cula

This comment has been minimized.

Show comment
Hide comment
@cula

cula Nov 4, 2016

The bug still exists in Scalafmt 0.4.8.1. Why closed?
Is there anything I can do to workaround this now?
default

cula commented Nov 4, 2016

The bug still exists in Scalafmt 0.4.8.1. Why closed?
Is there anything I can do to workaround this now?
default

@olafurpg

This comment has been minimized.

Show comment
Hide comment
@olafurpg

olafurpg Nov 4, 2016

Member

@cula this

indentOperator.exclude = "^(::|&&|\\|\\|)$"
unindentTopLevelOperators = true

will unindent the :: operator. You choose the line breaks, scalafmt doesn't wrap infix operators.

Member

olafurpg commented Nov 4, 2016

@cula this

indentOperator.exclude = "^(::|&&|\\|\\|)$"
unindentTopLevelOperators = true

will unindent the :: operator. You choose the line breaks, scalafmt doesn't wrap infix operators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment