-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fmt): add
prefer_single_line
option
- Loading branch information
Showing
18 changed files
with
422 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# `preferSingleLine` | ||
|
||
Control whether items should be placed on single line as possible, even they're originally on multiple lines. | ||
|
||
Default option value is `false`. | ||
|
||
This global option can be overridden by different syntax nodes: | ||
|
||
- `flowSequence.preferSingleLine` | ||
- `flowMap.preferSingleLine` | ||
|
||
## Example for `false` | ||
|
||
```yaml | ||
- [1, | ||
2, | ||
3] | ||
|
||
- [ | ||
1, 2, 3 | ||
] | ||
|
||
- {k1: v1, | ||
k2: v2, | ||
k3: v3} | ||
|
||
- { | ||
k1: v1, k2: v2, k3: v3} | ||
``` | ||
will be formatted as: | ||
```yaml | ||
- [1, 2, 3] | ||
|
||
- [ | ||
1, | ||
2, | ||
3, | ||
] | ||
|
||
- { k1: v1, k2: v2, k3: v3 } | ||
|
||
- { | ||
k1: v1, | ||
k2: v2, | ||
k3: v3, | ||
} | ||
``` | ||
|
||
## Example for `true` | ||
|
||
```yaml | ||
- [1, | ||
2, | ||
3] | ||
|
||
- [ | ||
1, 2, 3 | ||
] | ||
|
||
- {k1: v1, | ||
k2: v2, | ||
k3: v3} | ||
|
||
- { | ||
k1: v1, k2: v2, k3: v3} | ||
``` | ||
will be formatted as: | ||
```yaml | ||
- [1, 2, 3] | ||
|
||
- [1, 2, 3] | ||
|
||
- { k1: v1, k2: v2, k3: v3 } | ||
|
||
- { k1: v1, k2: v2, k3: v3 } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.