This guide covers common issues with the Prettier VS Code extension and how to resolve them.
- Prettier Not Formatting
- Wrong Formatting / Unexpected Results
- Performance Issues
- Plugin Issues
- Configuration Issues
- Getting Debug Logs
- Open a file you want to format
- Open Command Palette (
Cmd/Ctrl + Shift + P) - Run "Format Document With..."
- Select "Configure Default Formatter..."
- Choose "Prettier - Code formatter"
Or add to your settings.json:
{
"editor.defaultFormatter": "esbenp.prettier-vscode"
}Note: VS Code does NOT support combined language settings for editor.defaultFormatter. While VS Code 1.63+ supports combining multiple languages for some settings using syntax like [javascript][typescript], this feature does not work for the editor.defaultFormatter setting.
❌ This will NOT work:
{
"[markdown][yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}✅ Instead, use separate language blocks:
{
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}This is a VS Code core limitation, not an issue with the Prettier extension. The combined syntax works for other editor settings (like editor.wordWrap, editor.tabSize, etc.) but not for editor.defaultFormatter.
- Click "Prettier" in the VS Code status bar (bottom right)
- Check for any error messages in the output panel
If you see "Using bundled Prettier", the extension is working but using its built-in Prettier version. For project-specific formatting:
npm install --save-dev --save-exact prettierYour file might be ignored. Check if:
- The file is in
.prettierignore - The file is in
node_modules(ignored by default) - The file matches a pattern in your ignore file
If prettier.requireConfig is true, Prettier won't format files unless a config file exists:
{
"prettier.requireConfig": true
}Either set this to false or create a .prettierrc file.
If you don't like how Prettier formats your code, this is not a VS Code extension issue. The extension just runs Prettier - it doesn't control formatting rules.
To verify:
npx prettier --write yourfile.jsIf the CLI produces the same result, report the issue to prettier/prettier.
- Click "Prettier" in the status bar
- Look for "Prettier version: X.X.X"
Your project's local version takes precedence over the bundled version.
Prettier reads configuration from multiple sources:
.prettierrc,.prettierrc.json,.prettierrc.js, etc.prettierkey inpackage.json.editorconfig(ifprettier.useEditorConfigis true)- VS Code settings (only if no config file exists)
To see which config is being used:
npx prettier --find-config-path yourfile.jsPrettier can be slow on very large files. Consider:
- Breaking large files into smaller modules
- Adding specific files to
.prettierignore
Each plugin adds processing time. If you have many plugins, formatting will be slower.
Add to your VS Code settings:
{
"prettier.enableDebugLogs": true
}Then check the Prettier output panel for timing information.
Compare extension performance with CLI:
time npx prettier --write yourfile.jsIf the CLI is also slow, the issue is with Prettier, not the extension.
-
Ensure the plugin is installed locally:
npm install --save-dev prettier-plugin-xyz
-
Check that Prettier is also installed locally (plugins require local Prettier)
-
Some plugins need explicit configuration in
.prettierrc:{ "plugins": ["prettier-plugin-xyz"] }
If you have multiple plugins, they might conflict. Try disabling plugins one at a time to identify the conflict.
Plugins only work in trusted workspaces. If you see "This workspace is not trusted", click the trust button in VS Code.
VS Code settings for Prettier are only used when no configuration file exists. If you have a .prettierrc, those settings override VS Code settings.
Check config file location:
npx prettier --find-config-path yourfile.jsPrettier uses the nearest config file to the file being formatted. This can cause different files to use different configs.
If you have an .editorconfig file, it might override your Prettier settings. Either:
- Update
.editorconfigto match your Prettier config - Disable EditorConfig:
"prettier.useEditorConfig": false
When reporting issues, always include debug logs:
-
Add to VS Code settings:
{ "prettier.enableDebugLogs": true } -
Reload VS Code
-
Try to format the problematic file
-
Click "Prettier" in the status bar
-
Copy all the output
- Prettier extension version
- VS Code version
- Operating system
- Prettier version (
npx prettier --version) - Contents of your Prettier config file
- Full Prettier output log
- A link to a repository that reproduces the issue
- Search existing issues
- Check if it's a Prettier core issue
- Open a new issue with:
- A reproduction repository
- Debug logs
- All the information listed above