Skip to content

Commit

Permalink
feat: add flowCollectionPadding option
Browse files Browse the repository at this point in the history
When true, a single space of padding will be added inside the delimiters of non-empty single-line flow collections.

Fix #26
  • Loading branch information
longkai committed Dec 3, 2024
1 parent fa1b294 commit 0c8b42c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to the "kubernetes-yaml-formatter" extension will be documen

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## 2.3.1 (03 Dec 2024)

- add `better-yaml.flowCollectionPadding` option. When true, a single space of padding will be added inside the delimiters of non-empty single-line flow collections. Default true.

## 2.3.0 (19 Nov 2024)

- add `better-yaml.documentOptions.version` global option to set YAML version used by documents without a %YAML directive.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ This extension contributes the following settings:
* `better-yaml.directives`: Include directives in the output. If true, at least the document-start marker --- is always included. If false, no directives or marker is ever included. If null, directives and marker may be included if required.
* `better-yaml.commentString`: Change the comment prefix string. By default, empty comment lines are left empty, lines consisting of a single space are replaced by `#`, and all other lines are prefixed with a `#`.
* `better-yaml.lineWidth`: Maximum line width (set to 0 to disable folding). This is a soft limit, as only double-quoted semantics allow for inserting a line break in the middle of a word.
* `better-yaml.flowCollectionPadding`: When true, a single space of padding will be added inside the delimiters of non-empty single-line flow collections.
* `better-yaml.documentOptions.version`: The YAML version used by documents without a %YAML directive. Must be '1.1' or '1.2'. Default to '1.2'.

## Thanks
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@
"default": 0,
"description": "Maximum line width (set to 0 to disable folding). This is a soft limit, as only double-quoted semantics allow for inserting a line break in the middle of a word."
},
"better-yaml.flowCollectionPadding": {
"type": [
"boolean"
],
"default": true,
"description": "When true, a single space of padding will be added inside the delimiters of non-empty single-line flow collections."
},
"better-yaml.documentOptions.version": {
"type": [
"string"
Expand Down
1 change: 1 addition & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function makeFormattingOptions(conf: vscode.WorkspaceConfiguration, options: vsc
indentSeq: conf.get('better-yaml.indentSeq'),
directives: conf.get('better-yaml.directives'),
lineWidth: conf.get('better-yaml.lineWidth'),
flowCollectionPadding: conf.get('better-yaml.flowCollectionPadding'),
}
const commentString: string | undefined | null = conf.get('better-yaml.commentString')
if (commentString !== null && commentString !== undefined) {
Expand Down

0 comments on commit 0c8b42c

Please sign in to comment.