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 18, 2020
1 parent 7676259 commit ba56fe3
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
51 changes: 50 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,58 @@ 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.callSite = true
danglingParentheses.defnSite = true

# shortcut to set both
danglingParentheses = true
```

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

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

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

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

### `newlines.alwaysBeforeTopLevelStatements`

```scala mdoc:defaults
newlines.alwaysBeforeTopLevelStatements
newlines.alwaysBeforeTopLevelStatements = false
```

```scala mdoc:scalafmt
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 ba56fe3

Please sign in to comment.