Reputation: 23633
This is a simple question, but I'm curious about the "right" way to line-wrap curried functions in Scala. For example, suppose I have the moderately long line (if it's not long enough, you can pretend there are more parameters):
def executeFooBarCommand(ce: CommandExecutor)(implicit ec: ExecutionContext): Future[FooBar] = {
//...
}
I have two problems regarding wrapping the long definition:
First, I'm not sure what the accepted best practice is for wrapping such lines (or even longer ones.
Second, most reasonable ways of wrapping the line seem to result and in "auto-rejoin" of the wrapped lines when I format in eclipse. I set eclipse never to join wrapped lines in java, and there doesn't seem to be a relevant setting in the scala IDE formatting section that I can find, so I'm not sure how to prevent the format command from joining these wrapped lines.
Upvotes: 0
Views: 563
Reputation: 5712
Eclipse is based on scalariform, and so far it doesn't have this option. However, it can split parameters in the same parameter list, so you could try formatting it as:
def executeFooBarCommand(
ce: CommandExecutor)(implicit ec: ExecutionContext): Future[FooBar] = {
//...
}
Upvotes: 2