Skip to content

docs: explain how to select oxfmt as the formatter - #264

Open
KuSh wants to merge 1 commit into
oxc-project:mainfrom
KuSh:docs/formatter-selection
Open

KuSh wants to merge 1 commit into
oxc-project:mainfrom
KuSh:docs/formatter-selection

Conversation

@KuSh

@KuSh KuSh commented Sep 20, 2026

Copy link
Copy Markdown

Summary

Zed resolves the formatter from the per-language formatter setting. Its default, auto, uses Prettier when the language allows it and otherwise the first language server that advertises formatting support (Formatter::Auto in crates/project/src/lsp_store.rs). For JavaScript, TypeScript, TSX and Vue.js, Zed's defaults both allow Prettier and start the built-in vtsls, which formats as well — so an unconfigured project does not format with Oxfmt, and .oxfmtrc.json has no effect, without anything reporting it.

The settings that fix this are already in this repository: examples/oxfmt and examples/both name oxfmt for every language they cover and disallow Prettier there. The README pointed at the examples directory without stating the problem they solve, which left the required setting undiscoverable. This adds a short section saying what decides the formatter and showing the block for one language.

On the other half of #212 — the extension advertising itself as the preferred formatter — that is not expressible today: Formatter::Current takes the first server that advertises formatting, with no preference mechanism, and LanguageServerManifestEntry carries only languages, language_ids and code_action_kinds. A require_config_file option is being discussed in #29, where it belongs.

One correction to the report, for whoever picks this up: on current Zed, auto for those languages resolves to Prettier rather than to vtsls; vtsls wins only where Prettier is disallowed or unavailable. The wording added here covers both paths and claims neither.

Documentation only, no behaviour change.

AI disclosure: written with Claude Code under my review.

🤖 Generated with Claude Code

Zed resolves the formatter from the per-language `formatter` setting,
whose default `auto` prefers Prettier and otherwise takes the first
language server offering formatting. For JavaScript, TypeScript, TSX and
Vue.js the built-in `vtsls` also formats, so an unconfigured project does
not format with Oxfmt and ignores `.oxfmtrc.json`. The README pointed at
the examples directory without stating this, leaving the required setting
undiscoverable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant