You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ All notable changes to the "prettier-vscode" extension will be documented in thi
14
14
- Fixed parser detection fallback when using plugins with Prettier v3
15
15
- Added new Prettier v3 options: `objectWrap`, `experimentalOperatorPosition`
16
16
- Added support for TypeScript config files (`.prettierrc.ts`, `.prettierrc.cts`, `.prettierrc.mts`, `prettier.config.ts`, etc.) introduced in Prettier 3.5.0 - Thanks to [@dr2009](https://github.com/dr2009)
17
+
- Added `source.fixAll.prettier` code action for use with `editor.codeActionsOnSave` to run Prettier before other formatters like ESLint (#1277)
17
18
- Fixed issue where unnecessary TextEdits were applied when document was already formatted, which could cause spurious changes or cursor positioning issues (#3232)
Copy file name to clipboardExpand all lines: README.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -211,6 +211,31 @@ If you would like to format a document that is configured to be ignored by Prett
211
211
212
212
The recommended way of integrating with linters is to let Prettier do the formatting and configure the linter to not deal with formatting rules. You can find instructions on how to configure each linter on the Prettier docs site. You can then use each of the linting extensions as you normally would. For details refer to the [Prettier documentation](https://prettier.io/docs/en/integrating-with-linters.html).
213
213
214
+
### Using Code Actions on Save
215
+
216
+
You can use VS Code's `editor.codeActionsOnSave` to run Prettier before other formatters like ESLint. This is useful when you want to format with Prettier first and then apply ESLint fixes.
217
+
218
+
```jsonc
219
+
// .vscode/settings.json
220
+
{
221
+
"editor.codeActionsOnSave": {
222
+
"source.fixAll.prettier":"explicit",
223
+
},
224
+
}
225
+
```
226
+
227
+
You can also combine Prettier with ESLint:
228
+
229
+
```jsonc
230
+
// .vscode/settings.json
231
+
{
232
+
"editor.codeActionsOnSave": {
233
+
"source.fixAll.prettier":"explicit",
234
+
"source.fixAll.eslint":"explicit",
235
+
},
236
+
}
237
+
```
238
+
214
239
## Workspace Trust
215
240
216
241
This extension utilizes VS Code [Workspace Trust](https://code.visualstudio.com/docs/editor/workspace-trust) features. When this extension is run on an untrusted workspace, it will only use the built in version of prettier. No plugins, local, or global modules will be supported. Additionally, certain settings are also restricted - see each setting for details.
0 commit comments