emacs-scala-mode
emacs-scala-mode copied to clipboard
Introduce `scala-indent:defition-parameter-scaling-factor`
to control whether the parameter list of function/class should have a different indentation level.
See discussion in #172
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Thank you for the PR. It looks promising, but I would like to understand it better first.
It seems you want to only indent definition lists, but not function call lists. Why is this?
def foo(s: String, b: Int)
foo(
"shouldn't this row have an indent of four spaces compared to the function name?",
0
)
Thank you for the PR. It looks promising, but I would like to understand it better first.
It seems you want to only indent definition lists, but not function call lists. Why is this?
def foo(s: String, b: Int) foo( "shouldn't this row have an indent of four spaces compared to the function name?", 0 )
Yeah, that's the databricks scala style, I don't know why the chose so.
https://github.com/databricks/scala-style-guide#indent
I'm still thinking about how to handle extends
and with
after class
parameter list.
For classes whose header doesn't fit in two lines, use 4 space indentation for its parameters, put each in each line, put the extends on the next line with 2 space indent, and add a blank line after class header.
class Foo(
val param1: String, // 4 space indent for parameters
val param2: String,
val param3: Array[Byte])
extends FooInterface // 2 space indent here
with Logging {
def firstMethod(): Unit = { ... } // blank line above
}
For method and class constructor invocations, use 2 space indentation for its parameters and put each in each line when the parameters don't fit in two lines.
foo(
someVeryLongFieldName, // 2 space indent here
andAnotherVeryLongFieldName,
"this is a string",
3.1415)
new Bar(
someVeryLongFieldName, // 2 space indent here
andAnotherVeryLongFieldName,
"this is a string",
3.1415)
@mzhaom did you have a chance to look at my other comments