Skip to content

Add consistency to parameter lists formatting #1952

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

Merged
merged 3 commits into from
May 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions _style/declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,32 @@ There are three main reasons you should do this:
List("").foldLeft[Int](0, _ + _.length)

For complex DSLs, or with type-names that are long, it can be difficult
to fit the entire signature on one line. In those cases, align the
open-paren of the parameter lists, one list per line (i.e. if you can't
put them all on one line, put one each per line):
to fit the entire signature on one line. For those cases there are several
different styles in use:

1. Split the parameter lists, one parameter per line with
[trailing commas](https://docs.scala-lang.org/sips/trailing-commas.html#motivation)
and parentheses being on separate lines adding to visual separation between
the lists:

protected def forResource(
resourceInfo: Any,
)(
f: (JsonNode) => Any,
)(implicit
urlCreator: URLCreator,
configurer: OAuthConfiguration,
): Any = {
...
}

protected def forResource(resourceInfo: Any)
(f: (JsonNode) => Any)
(implicit urlCreator: URLCreator, configurer: OAuthConfiguration): Any = {
...
}
2. Or align the open-paren of the parameter lists, one list per line:

protected def forResource(resourceInfo: Any)
(f: (JsonNode) => Any)
(implicit urlCreator: URLCreator, configurer: OAuthConfiguration): Any = {
...
}

#### Higher-Order Functions

Expand Down