From 62cb0769c9aa95f007bb477904bc5b30b64995dd Mon Sep 17 00:00:00 2001 From: Salam Elbilig Date: Thu, 12 Feb 2026 13:40:25 -0800 Subject: [PATCH 1/2] feat(opencode): add `cljfmt` formatter support for Clojure files --- packages/opencode/src/format/formatter.ts | 9 +++++++++ packages/web/src/content/docs/formatters.mdx | 1 + 2 files changed, 10 insertions(+) diff --git a/packages/opencode/src/format/formatter.ts b/packages/opencode/src/format/formatter.ts index 9e97fae9dfc8..418446958029 100644 --- a/packages/opencode/src/format/formatter.ts +++ b/packages/opencode/src/format/formatter.ts @@ -364,3 +364,12 @@ export const ormolu: Info = { return Bun.which("ormolu") !== null }, } + +export const cljfmt: Info = { + name: "cljfmt", + command: ["cljfmt", "fix", "--quiet", "$FILE"], + extensions: [".clj", ".cljs", ".cljc", ".edn"], + async enabled() { + return Bun.which("cljfmt") !== null + }, +} diff --git a/packages/web/src/content/docs/formatters.mdx b/packages/web/src/content/docs/formatters.mdx index 54f36e0cd0e8..4c0bb321a890 100644 --- a/packages/web/src/content/docs/formatters.mdx +++ b/packages/web/src/content/docs/formatters.mdx @@ -37,6 +37,7 @@ OpenCode comes with several built-in formatters for popular languages and framew | pint | .php | `laravel/pint` dependency in `composer.json` | | oxfmt (Experimental) | .js, .jsx, .ts, .tsx | `oxfmt` dependency in `package.json` and an [experimental env variable flag](/docs/cli/#experimental) | | ormolu | .hs | `ormolu` command available | +| cljfmt | .clj, .cljs, .cljc, .edn | `cljfmt` command available | So if your project has `prettier` in your `package.json`, OpenCode will automatically use it. From dcc931401e72be143c62a2bcdf9ed2ef8c888b26 Mon Sep 17 00:00:00 2001 From: Salam Elbilig Date: Thu, 12 Feb 2026 21:41:40 -0800 Subject: [PATCH 2/2] docs(web): sort built-in formatter entries by alphabetical order of names --- packages/web/src/content/docs/formatters.mdx | 36 ++++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/web/src/content/docs/formatters.mdx b/packages/web/src/content/docs/formatters.mdx index 4c0bb321a890..0cb947b08f01 100644 --- a/packages/web/src/content/docs/formatters.mdx +++ b/packages/web/src/content/docs/formatters.mdx @@ -13,31 +13,31 @@ OpenCode comes with several built-in formatters for popular languages and framew | Formatter | Extensions | Requirements | | -------------------- | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -| gofmt | .go | `gofmt` command available | -| mix | .ex, .exs, .eex, .heex, .leex, .neex, .sface | `mix` command available | -| prettier | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml, and [more](https://prettier.io/docs/en/index.html) | `prettier` dependency in `package.json` | +| air | .R | `air` command available | | biome | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml, and [more](https://biomejs.dev/) | `biome.json(c)` config file | -| zig | .zig, .zon | `zig` command available | +| cargofmt | .rs | `cargo fmt` command available | | clang-format | .c, .cpp, .h, .hpp, .ino, and [more](https://clang.llvm.org/docs/ClangFormat.html) | `.clang-format` config file | +| cljfmt | .clj, .cljs, .cljc, .edn | `cljfmt` command available | +| dart | .dart | `dart` command available | +| gleam | .gleam | `gleam` command available | +| gofmt | .go | `gofmt` command available | +| htmlbeautifier | .erb, .html.erb | `htmlbeautifier` command available | | ktlint | .kt, .kts | `ktlint` command available | +| mix | .ex, .exs, .eex, .heex, .leex, .neex, .sface | `mix` command available | +| nixfmt | .nix | `nixfmt` command available | +| ocamlformat | .ml, .mli | `ocamlformat` command available and `.ocamlformat` config file | +| ormolu | .hs | `ormolu` command available | +| oxfmt (Experimental) | .js, .jsx, .ts, .tsx | `oxfmt` dependency in `package.json` and an [experimental env variable flag](/docs/cli/#experimental) | +| pint | .php | `laravel/pint` dependency in `composer.json` | +| prettier | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml, and [more](https://prettier.io/docs/en/index.html) | `prettier` dependency in `package.json` | +| rubocop | .rb, .rake, .gemspec, .ru | `rubocop` command available | | ruff | .py, .pyi | `ruff` command available with config | | rustfmt | .rs | `rustfmt` command available | -| cargofmt | .rs | `cargo fmt` command available | -| uv | .py, .pyi | `uv` command available | -| rubocop | .rb, .rake, .gemspec, .ru | `rubocop` command available | +| shfmt | .sh, .bash | `shfmt` command available | | standardrb | .rb, .rake, .gemspec, .ru | `standardrb` command available | -| htmlbeautifier | .erb, .html.erb | `htmlbeautifier` command available | -| air | .R | `air` command available | -| dart | .dart | `dart` command available | -| ocamlformat | .ml, .mli | `ocamlformat` command available and `.ocamlformat` config file | | terraform | .tf, .tfvars | `terraform` command available | -| gleam | .gleam | `gleam` command available | -| nixfmt | .nix | `nixfmt` command available | -| shfmt | .sh, .bash | `shfmt` command available | -| pint | .php | `laravel/pint` dependency in `composer.json` | -| oxfmt (Experimental) | .js, .jsx, .ts, .tsx | `oxfmt` dependency in `package.json` and an [experimental env variable flag](/docs/cli/#experimental) | -| ormolu | .hs | `ormolu` command available | -| cljfmt | .clj, .cljs, .cljc, .edn | `cljfmt` command available | +| uv | .py, .pyi | `uv` command available | +| zig | .zig, .zon | `zig` command available | So if your project has `prettier` in your `package.json`, OpenCode will automatically use it.