-
-
Notifications
You must be signed in to change notification settings - Fork 501
Description
Preflight Checklist
- I have read the troubleshooting guide
- I have searched existing issues and this is not a duplicate
- This is a bug with the VS Code extension, not with how Prettier formats code
Issue Summary
In my settings.json I have the following:
"[css][html][markdown][yaml]": {
"editor.defaultFormatter": "prettier.prettier-vscode",
"editor.formatOnSave": true,
},
This worked just with with the legacy Prettier extension. However, with the new one, formatting on save does not work properly, and you have to split them up into individual blocks like this:
"[css]": {
"editor.defaultFormatter": "prettier.prettier-vscode",
"editor.formatOnSave": true,
},
"[html]": {
"editor.defaultFormatter": "prettier.prettier-vscode",
"editor.formatOnSave": true,
},
"[markdown]": {
"editor.defaultFormatter": "prettier.prettier-vscode",
"editor.formatOnSave": true,
},
"[yaml]": {
"editor.defaultFormatter": "prettier.prettier-vscode",
"editor.formatOnSave": true,
},
Steps to Reproduce
Copy paste the following commands into a terminal:
mkdir test
cd test
npm init --yes
npm install --save prettier
echo '
test' > README.md
mkdir .vscode
echo '
{
"[markdown]": {
"editor.defaultFormatter": "prettier.prettier-vscode",
"editor.formatOnSave": true,
},
}
' > .vscode/settings.json
vscode .Now, open the "README.md" file. Press Ctrl + s to save the file and it will successfully be formatted.
Next, we change the "settings.json" file:
echo '
{
"[markdown][yaml]": {
"editor.defaultFormatter": "prettier.prettier-vscode",
"editor.formatOnSave": true,
},
}
' > .vscode/settings.json
vscode .Now, open the "README.md" file. Press Ctrl + s to save the file and it will not be formatted!
Expected Behavior
I expect this to work in the same way that it has been for years.
Actual Behavior
It doesn't work.
Operating System
Windows
VS Code Version
Version: 1.107.0 (user setup) Commit: 618725e67565b290ba4da6fe2d29f8fa1d4e3622 Date: 2025-12-10T07:43:47.883Z Electron: 39.2.3 ElectronBuildId: 12895514 Chromium: 142.0.7444.175 Node.js: 22.21.1 V8: 14.2.231.21-electron.0 OS: Windows_NT x64 10.0.26100
Prettier Extension Version
12.0.7
Prettier Version
3.7.4
Prettier Extension Logs
["INFO" - 4:35:03 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 4:35:03 PM] No local configuration (i.e. .prettierrc or .editorconfig) detected, will fall back to VS Code configuration
Prettier Configuration
No config needed to reproduce the problem.