Skip to content
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

BinPack.ParentCtors: describe each option in doc #4548

Merged
merged 1 commit into from
Nov 14, 2024
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
25 changes: 25 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5041,6 +5041,10 @@ The behaviour of `binPack.parentConstructors = source` depends on the value of
[`newlines.source`](#newlinessource); `keep` maps to `keep` and attempts to preserve the
space if there's no line break in the source, `fold` maps to `Oneline`, rest to `Never`.

#### `binPack.parentConstructors=Always`

This option attempts to binpack parents, formatting as many on each line as will fit.

```scala mdoc:scalafmt
binPack.parentConstructors = Always
maxColumn = 30
Expand All @@ -5053,6 +5057,12 @@ object A {
}
```

#### `binPack.parentConstructors=Never`

This option will attempt to format the entire declaration on one line (starting
with `class` or `trait` and including all parents); otherwise, will enforce
breaks before each.

```scala mdoc:scalafmt
binPack.parentConstructors = Never
maxColumn = 30
Expand All @@ -5062,6 +5072,11 @@ object A {
}
```

#### `binPack.parentConstructors=Oneline`

This option will attempt to format all parents on one line (starting with
`extends` and including all parents); otherwise, will enforce breaks before each.

```scala mdoc:scalafmt
binPack.parentConstructors = Oneline
maxColumn = 30
Expand All @@ -5079,6 +5094,12 @@ object A {
}
```

#### `binPack.parentConstructors=OnelineIfPrimaryOneline`

This option will attempt to format all parents on one line (from `extends` and
including all parents), but only if the primary constructor fits on one line
as well (the same or previous); otherwise, will enforce breaks before each.

```scala mdoc:scalafmt
binPack.parentConstructors = OnelineIfPrimaryOneline
maxColumn = 30
Expand All @@ -5095,6 +5116,10 @@ object A {
}
```

#### `binPack.parentConstructors=keep`

This option attempts to preserve breaks before each parent.

```scala mdoc:scalafmt
binPack.parentConstructors = keep
---
Expand Down
Loading