Skip to content

Commit

Permalink
Add singleAttributePerLine and bracketSameLine settings (prettier#2573)
Browse files Browse the repository at this point in the history
* chore: bump @types/prettier from 2.4.4 to 2.6.0

* feat: add singleAttributePerLine and bracketSameLine options

* docs: update changelog

Co-authored-by: Nathan Totten <[email protected]>
  • Loading branch information
cotneit and ntotten authored Jul 21, 2022
1 parent ac00f10 commit c3b340d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to the "prettier-vscode" extension will be documented in thi

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

## [Unreleased]

- Added [`singleAttributePerLine`](https://prettier.io/docs/en/options.html#single-attribute-per-line) setting (Prettier 2.6.0)
- Added [`bracketSameLine`](https://prettier.io/docs/en/options.html#bracket-line) setting (Prettier 2.4.0)
- Added deprecation notice for [`jsxBracketSameLine`](https://prettier.io/docs/en/options.html#deprecated-jsx-brackets) setting (Prettier 2.4.0)
- Allow formatting ranges in `vue`.
-
## [9.6.0]

- Prettier 2.7.1
Expand All @@ -20,10 +27,6 @@ All notable changes to the "prettier-vscode" extension will be documented in thi

- Prettier 2.6.1

## [Unreleased]

- Allow formatting ranges in `vue`.

## [9.3.0]

- Remove `.gts` and `.gjs` from Handlebars extensions
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ prettier.bracketSpacing
prettier.endOfLine
prettier.htmlWhitespaceSensitivity
prettier.insertPragma
prettier.singleAttributePerLine
prettier.bracketSameLine
prettier.jsxBracketSameLine
prettier.jsxSingleQuote
prettier.printWidth
Expand Down
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,18 @@
"markdownDescription": "%ext.config.bracketSpacing%",
"scope": "resource"
},
"prettier.singleAttributePerLine": {
"type": "boolean",
"default": false,
"markdownDescription": "%ext.config.singleAttributePerLine%",
"scope": "resource"
},
"prettier.bracketSameLine": {
"type": "boolean",
"default": false,
"markdownDescription": "%ext.config.bracketSameLine%",
"scope": "resource"
},
"prettier.jsxBracketSameLine": {
"type": "boolean",
"default": false,
Expand Down
4 changes: 3 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"ext.config.htmlWhitespaceSensitivity": "Specify the global whitespace sensitivity for HTML files.\n Valid options:\n- `css` - Respect the default value of CSS display property.\n- `strict` - Whitespaces are considered sensitive.\n- `ignore` - Whitespaces are considered insensitive.",
"ext.config.ignorePath": "Path to a .prettierignore file",
"ext.config.insertPragma": "Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier. This works well when used in tandem with the `--require-pragma` option. If there is already a docblock at the top of the file then this option will add a newline to it with the @format marker.",
"ext.config.jsxBracketSameLine": "If true, puts the `>` of a multi-line jsx element at the end of the last line instead of being alone on the next line",
"ext.config.singleAttributePerLine": "If true, enforces single attribute per line in HTML, Vue and JSX.",
"ext.config.bracketSameLine": "If true, puts the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being alone on the next line (does not apply to self closing elements).",
"ext.config.jsxBracketSameLine": "**DEPRECATED** since Prettier v2.4.0, use `bracketSameLine` instead.\n\nIf true, puts the `>` of a multi-line jsx element at the end of the last line instead of being alone on the next line (does not apply to self closing elements).",
"ext.config.jsxSingleQuote": "Use single quotes instead of double quotes in JSX",
"ext.config.packageManager": "The package manager you use to install node modules.",
"ext.config.packageManagerDeprecation": "Package manager is now automatically detected by VS Code. This setting is no longer used.",
Expand Down
2 changes: 2 additions & 0 deletions src/PrettierEditService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,8 @@ export default class PrettierEditService implements Disposable {
vsOpts.endOfLine = vsCodeConfig.endOfLine;
vsOpts.htmlWhitespaceSensitivity = vsCodeConfig.htmlWhitespaceSensitivity;
vsOpts.insertPragma = vsCodeConfig.insertPragma;
vsOpts.singleAttributePerLine = vsCodeConfig.singleAttributePerLine;
vsOpts.bracketSameLine = vsCodeConfig.bracketSameLine;
vsOpts.jsxBracketSameLine = vsCodeConfig.jsxBracketSameLine;
vsOpts.jsxSingleQuote = vsCodeConfig.jsxSingleQuote;
vsOpts.printWidth = vsCodeConfig.printWidth;
Expand Down

0 comments on commit c3b340d

Please sign in to comment.