scala-ide / scalariform

Scala source code formatter
http://scala-ide.github.com/scalariform/
MIT License
527 stars 148 forks source link

Weird named argument formatting #240

Closed wedens closed 7 years ago

wedens commented 7 years ago

scalariform with default configuration performs following formatting:

  val failingSessionManager = SessionManager[Task, Unit](
    touchSession = _ => Task.delay(
    sys.error("touchSession should not be called")
  ),
    newSession = (_, _) => Task.delay(
    sys.error("newSession should not be called")
  )
  )

  def singletonSessionManager(s: Session[Unit]) =
    failingSessionManager.copy(
      touchSession = sessionId0 => Task.now {
      (sessionId0 === s.id).option(s)
    }
    )

I'd rather have it formatted like this:

  val failingSessionManager = SessionManager[Task, Unit](
    touchSession = _ => Task.delay(
      sys.error("touchSession should not be called")
    ),
    newSession = (_, _) => Task.delay(
      sys.error("newSession should not be called")
    )
  )

  def singletonSessionManager(s: Session[Unit]) =
    failingSessionManager.copy(
      touchSession = sessionId0 => Task.now {
        (sessionId0 === s.id).option(s)
      }
    )

Is it a bug, or maybe there is some option to tune this behaviour?

cvogt commented 7 years ago

+1. This bug is driving me nuts :).

cvogt commented 7 years ago

Seems to be fixed in master. I tried it.