Setup editors
Editor extensions use oxfmt --lsp from your project, so oxfmt must be installed locally.
See Quickstart to install Oxfmt.
Supported editors
- VS Code (and Cursor, etc.)
- Zed
- JetBrains
- Neovim
- Other editors
VS Code
Install
Download the official Oxc VS Code extension from:
The extension is compatible with other VS Code-based editors, including Cursor.
Team setup
- Recommend the extension for contributors:
.vscode/extensions.json:
json
{
"recommendations": ["oxc.oxc-vscode"]
}- Enable format on save in
.vscode/settings.json:
json
{
"oxc.fmt.configPath": ".oxfmtrc.json",
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSave": true
}To set per language:
json
{
"[javascript]": {
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSave": true
}
}Reference
Zed
Install
Reference
JetBrains
IntelliJ IDEA and WebStorm.
Install
Reference
Neovim
nvim-lspconfig
sh
npm i -g oxfmtlua
vim.lsp.enable('oxfmt')conform.nvim
lua
require("conform").setup({
formatters_by_ft = {
javascript = { "oxfmt" },
javascriptreact = { "oxfmt" },
typescript = { "oxfmt" },
typescriptreact = { "oxfmt" },
json = { "oxfmt" },
vue = { "oxfmt" },
},
})coc.nvim
vim
:CocInstall coc-oxcOther editors
For editors with LSP support (Emacs, Helix, Sublime), configure:
sh
oxfmt --lspOr, for editors without LSP support:
sh
cat foo/bar.js | oxfmt --stdin-filepath dummy.js --config ./path/to/config.json