coc-oxc
oxcOxc extension for coc.nvim
Published Package Summary
coc-oxc
Oxc extension for coc.nvim
Install
:CocInstall coc-oxc
Features
- oxlint: Fast linter with auto-fix support
- oxfmt: Fast formatter with format-on-save support
Note: This plugin only uses oxlint and oxfmt installed in the respective project; it does not activate globally.
Configurations
Oxlint (Linter)
oxc.oxlint.enable: Enable oxlint language server (default:true)oxc.oxlint.run: Run the linter on saveonSaveor on typeonType(default:onType)oxc.oxlint.configPath: Path to oxlint configuration (default:null, searches for.oxlintrc.json)oxc.oxlint.binPath: Path to theoxlintbinary (default: searches innode_modules/.bin)oxc.oxlint.codeActionsOnSave: Code action kinds to apply on save, e.g.["source.fixAll.oxc"](default:[], disabled)
Oxfmt (Formatter)
oxc.oxfmt.enable: Enable oxfmt formatting (default:true)oxc.oxfmt.binPath: Path to theoxfmtbinary (default: searches innode_modules/.bin)oxc.oxfmt.formatterPriority: Priority used when multiple formatters are registered for a language. Only positive values boost; the default1outranks formatters that do not set a priority. To defer for a given language, usecoc.preferences.formatterExtensioninstead (default:1)
Format on Save
To enable format on save, add this to your coc-config (:CocConfig):
{
"oxc.oxfmt.enable": true,
"coc.preferences.formatterExtension": "coc-oxc"
}
coc.preferences.formatterExtension tells coc.nvim to use coc-oxc whenever it is available, which avoids conflicts with other extensions that also register an LSP formatter (e.g. coc-biome, coc-tsserver, coc-prettier). You can scope it per-language if you want a different formatter for some files:
{
"[json]": { "coc.preferences.formatterExtension": "coc-prettier" }
}
oxfmt also registers itself with oxc.oxfmt.formatterPriority 1 by default, which outranks any extension that does not set a priority.
You can also format manually with :call CocAction('format')
Fix on Save
To apply oxlint's auto-fixes on save, add this to your coc-config (:CocConfig):
{
"oxc.oxlint.codeActionsOnSave": ["source.fixAll.oxc"]
}
License
MIT
This extension is built with create-coc-extension
- Oxc extension for coc.nvim
- onLanguage:css
- onLanguage:graphql
- onLanguage:handlebars
- onLanguage:html
- onLanguage:javascript
- onLanguage:javascriptreact
- onLanguage:json
- onLanguage:json5
- onLanguage:jsonc
- onLanguage:less
- onLanguage:markdown
- onLanguage:scss
- onLanguage:svelte
- onLanguage:typescript
- onLanguage:typescriptreact
- onLanguage:vue
- onLanguage:yaml
Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.
Open Developer GuideVersion History
This published npm package does not include a history.md or changelog.md file. Browse its npm versions or repository releases for available release information.
Contributed Commands
All contributes.commands entries from the published package manifest for coc-oxc@0.3.0.
| Command (:CocCommand) | Description |
|---|---|
| oxlint.restartServer | Restart oxlint Server |
| oxlint.showOutputChannel | Show oxlint Output Channel |
| oxfmt.restartServer | Restart oxfmt Server |
| oxfmt.showOutputChannel | Show oxfmt Output Channel |
Configuration Schema
All contributes.configuration entries from the published package manifest, including each raw property schema for coc-settings.json.
Raw JSON Schema
{
"enum": [
"onSave",
"onType"
],
"type": "string",
"scope": "resource",
"default": "onType",
"description": "Run oxlint on save (onSave) or on type (onType)"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable oxfmt language server"
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Path to the `oxfmt` binary"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable oxlint language server"
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Path to the `oxlint` binary"
}Raw JSON Schema
{
"type": [
"string",
"null"
],
"scope": "resource",
"default": null,
"description": "Path to oxlint configuration. Keep it empty to enable nested configuration."
}Raw JSON Schema
{
"type": "number",
"default": 1,
"description": "Priority of the oxfmt formatter when multiple formatters are registered for a language. Only positive values boost; the default of 1 outranks formatters that do not set a priority. To defer to another formatter for a given language, use coc.preferences.formatterExtension instead."
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"scope": "resource",
"default": [],
"description": "Code action kinds to apply on save (e.g. `source.fixAll.oxc`). Leave empty to disable."
}