设置编辑器
🌐 Setup editors
编辑器扩展使用你项目中的 oxfmt --lsp,因此必须在本地安装 oxfmt。
🌐 Editor extensions use oxfmt --lsp from your project, so oxfmt must be installed locally.
请参阅 快速开始 安装 Oxfmt。
🌐 See Quickstart to install Oxfmt.
支持的编辑器
🌐 Supported editors
VS Code
安装
🌐 Install
从以下位置下载官方 Oxc VS Code 扩展:
🌐 Download the official Oxc VS Code extension from:
该扩展与其他基于 VS Code 的编辑器兼容,包括 Cursor。
团队设置
🌐 Team setup
- 推荐给贡献者的扩展:
.vscode/extensions.json:
json
{
"recommendations": ["oxc.oxc-vscode"]
}- 在
.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 和 WebStorm。
🌐 IntelliJ IDEA and WebStorm.
安装
🌐 Install
参考
🌐 Reference
coc.nvim
安装
🌐 Install
vim
:CocInstall coc-oxc参考
🌐 Reference
其他编辑
🌐 Other editors
对于支持 LSP 的编辑器(Neovim、Emacs、Helix、Sublime),请配置:
🌐 For editors with LSP support (Neovim, Emacs, Helix, Sublime), configure:
bash
oxfmt --lsp通过标准输入
🌐 Via stdin
对于不支持 LSP 的编辑器:
🌐 For editors without LSP support:
sh
cat foo/bar.js | oxfmt --stdin-filepath f.js --config ./path/to/config.json参考
🌐 Reference
