Visual Studio Marketplace | Open VSX Registry
Try formatters in priority order and use the first one that is available. This extension acts as a composite default formatter, so you can fall back when your preferred formatter is not installed or cannot handle a file type.
Unlike extensions that run every formatter in sequence, vscode-formatter-fallback stops after the first successful formatter.
Setup
- Install vscode-formatter-fallback and the formatter extensions you want to use.
- Set vscode-formatter-fallback as the default formatter for each language you want to manage.
- Configure an ordered fallback list under the same language block.
{
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "chrismeyers.vscode-formatter-fallback",
"formatterFallback.formatters": [
"oxc.oxc-vscode",
"esbenp.prettier-vscode"
]
}
}
When you save or run Format Document, vscode-formatter-fallback tries each extension ID in order and uses the first formatter that is installed and can format the file.
Extension IDs use the publisher.name format. You can find them by:
- Opening Format Document With... and checking the formatter list
- Editing
editor.defaultFormatter in settings.json and using the autocomplete enum
- Looking at an extension's page on the Visual Studio Marketplace
Settings
| Setting |
Description |
formatterFallback.enabled |
Enable or disable the extension. Default: true. |
formatterFallback.formatters |
Ordered list of formatter extension IDs for the current language scope. |
Language-specific settings work the same way as editor.defaultFormatter. Put formatterFallback.formatters inside a language block such as "[typescript]".
Behavior
- Format on save: Works with VS Code's built-in
editor.formatOnSave.
- Manual format: Works with Format Document when vscode-formatter-fallback is the default formatter.
- Unavailable formatters: Skipped automatically; the next formatter in the list is tried.
- No available formatters: Returns no edits and logs details to the Formatter Fallback output channel.
Requirements
- You must set
editor.defaultFormatter to chrismeyers.vscode-formatter-fallback for each language where you want fallback behavior.
- Formatter extensions in your list must be installed separately.
Known limitations
- Formatter availability is determined by attempting delegation; VS Code does not expose a public API to list formatters for a language.
- Temporary
editor.defaultFormatter overrides are restored immediately after formatting.
formatOnPaste and formatOnType are not handled unless VS Code invokes the document formatter for those actions.
Multi Formatter runs every configured formatter in sequence. vscode-formatter-fallback uses only the first formatter that succeeds, which is useful when you want a primary formatter with fallbacks rather than a formatting pipeline.