Skip to content

Commit

Permalink
Documentation: describe a few important parameters
Browse files Browse the repository at this point in the history
Fixes #1659.
Fixes #1482.

Helps with #1523.
  • Loading branch information
kitbellew committed Feb 19, 2020
1 parent 34d6b9d commit c01dd0d
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
49 changes: 49 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,54 @@ insert newlines.
> You might be interested in the [Vertical Multiline](#vertical-multiline)
> section.
### `danglingParentheses`

While this parameter is not technically under the `newlines` section, it logically belongs there.

```scala mdoc:defaults
danglingParentheses
```

```scala mdoc:scalafmt
danglingParentheses.defnSite = true
danglingParentheses.callSite = true
# shortcut to set both
danglingParentheses = true
---
object a {
// defnSite
def method(
a: Int,
b: String
): Boolean

// callSite
method(
a,
b
)
}
```

```scala mdoc:scalafmt
danglingParentheses.defnSite = false
danglingParentheses.callSite = false
# shortcut to set both
danglingParentheses = false
---
object a {
// defnSite
def method(
a: Int,
b: String): Boolean

// callSite
method(
a,
b)
}
```

### `newlines.alwaysBeforeTopLevelStatements`

```scala mdoc:defaults
Expand Down Expand Up @@ -520,6 +568,7 @@ Configuration options and default values:

- `rewrite.redundantBraces.maxLines = 100`
- `rewrite.redundantBraces.includeUnitMethods = true`
- `rewrite.redundantBraces.methodBodies = true`
- `rewrite.redundantBraces.stringInterpolation = true`
- `rewrite.redundantBraces.generalExpressions = false` (disabled by default due
to #1147)
Expand Down
4 changes: 4 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ editors in their respective parts of the

## sbt

NB: keep in mind that versions of `scalafmt-core` and `sbt-scalafmt` are released
independently and don't have to align. The version of `scalafmt-core` is defined
in the `.scalafmt.conf` configuration file and downloaded dynamically.

```scala
// In project/plugins.sbt. Note, does not support sbt 0.13, only sbt 1.x.
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.2.1")
Expand Down

0 comments on commit c01dd0d

Please sign in to comment.