Wednesday, 18 September 2013

How do I fix the scala autoindent script for vim?

How do I fix the scala autoindent script for vim?

The current vim indent script for Scala has a strange behavior, in that it
seems to indent after the first line of a code block; indenting the code
package akka.tutorial.first.scala
import akka.actor._
import akka.routing.RoundRobinRouter
import scala.concurrent.duration._
object PdfsFrecpo extends App {
def calculate(nrOfWorkers: Int, nrOfElements: Int, nrOfMessages: Int) {
// Create an Akka system
val system = ActorSystem("PiSystem")
// create the result listener, which will print the result and shutdown
the system
val listener = system.actorOf(Props[Listener], name = "listener")
// create the master
val master = system.actorOf(Props(new Master(
nrOfWorkers, nrOfMessages, nrOfElements, listener)),
name = "master")
// start the calculation
master ! Calculate
}
calculate(nrOfWorkers = 4, nrOfElements = 10000, nrOfMessages = 10000)
}
yields
package akka.tutorial.first.scala
import akka.actor._
import akka.routing.RoundRobinRouter
import scala.concurrent.duration._
object PdfsFrecpo extends App {
def calculate(nrOfWorkers: Int, nrOfElements: Int, nrOfMessages: Int) {
// Create an Akka system
val system = ActorSystem("PiSystem")
// create the result listener, which will print the result and
shutdown the system
val listener = system.actorOf(Props[Listener], name = "listener")
// create the master
val master = system.actorOf(Props(new Master(
nrOfWorkers, nrOfMessages, nrOfElements, listener)),
name = "master")
// start the calculation
master ! Calculate
}
calculate(nrOfWorkers = 4, nrOfElements = 10000, nrOfMessages = 10000)
}
I don't know if this is intentional, but I would personally prefer no
additional indentation after the first line of the code block, i.e. the
lines // create the result listener... and following should be aligned
with val system = ....
Any pointers?

No comments:

Post a Comment