Skip to content

Commit 9b23130

Browse files
feat(opencode): add cljfmt formatter support for Clojure files (#13426)
1 parent 62a24c2 commit 9b23130

2 files changed

Lines changed: 27 additions & 17 deletions

File tree

packages/opencode/src/format/formatter.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,3 +364,12 @@ export const ormolu: Info = {
364364
return Bun.which("ormolu") !== null
365365
},
366366
}
367+
368+
export const cljfmt: Info = {
369+
name: "cljfmt",
370+
command: ["cljfmt", "fix", "--quiet", "$FILE"],
371+
extensions: [".clj", ".cljs", ".cljc", ".edn"],
372+
async enabled() {
373+
return Bun.which("cljfmt") !== null
374+
},
375+
}

packages/web/src/content/docs/formatters.mdx

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,31 @@ OpenCode comes with several built-in formatters for popular languages and framew
1313

1414
| Formatter | Extensions | Requirements |
1515
| -------------------- | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
16-
| gofmt | .go | `gofmt` command available |
17-
| mix | .ex, .exs, .eex, .heex, .leex, .neex, .sface | `mix` command available |
18-
| prettier | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml, and [more](https://prettier.io/docs/en/index.html) | `prettier` dependency in `package.json` |
16+
| air | .R | `air` command available |
1917
| biome | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml, and [more](https://biomejs.dev/) | `biome.json(c)` config file |
20-
| zig | .zig, .zon | `zig` command available |
18+
| cargofmt | .rs | `cargo fmt` command available |
2119
| clang-format | .c, .cpp, .h, .hpp, .ino, and [more](https://clang.llvm.org/docs/ClangFormat.html) | `.clang-format` config file |
20+
| cljfmt | .clj, .cljs, .cljc, .edn | `cljfmt` command available |
21+
| dart | .dart | `dart` command available |
22+
| gleam | .gleam | `gleam` command available |
23+
| gofmt | .go | `gofmt` command available |
24+
| htmlbeautifier | .erb, .html.erb | `htmlbeautifier` command available |
2225
| ktlint | .kt, .kts | `ktlint` command available |
26+
| mix | .ex, .exs, .eex, .heex, .leex, .neex, .sface | `mix` command available |
27+
| nixfmt | .nix | `nixfmt` command available |
28+
| ocamlformat | .ml, .mli | `ocamlformat` command available and `.ocamlformat` config file |
29+
| ormolu | .hs | `ormolu` command available |
30+
| oxfmt (Experimental) | .js, .jsx, .ts, .tsx | `oxfmt` dependency in `package.json` and an [experimental env variable flag](/docs/cli/#experimental) |
31+
| pint | .php | `laravel/pint` dependency in `composer.json` |
32+
| prettier | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml, and [more](https://prettier.io/docs/en/index.html) | `prettier` dependency in `package.json` |
33+
| rubocop | .rb, .rake, .gemspec, .ru | `rubocop` command available |
2334
| ruff | .py, .pyi | `ruff` command available with config |
2435
| rustfmt | .rs | `rustfmt` command available |
25-
| cargofmt | .rs | `cargo fmt` command available |
26-
| uv | .py, .pyi | `uv` command available |
27-
| rubocop | .rb, .rake, .gemspec, .ru | `rubocop` command available |
36+
| shfmt | .sh, .bash | `shfmt` command available |
2837
| standardrb | .rb, .rake, .gemspec, .ru | `standardrb` command available |
29-
| htmlbeautifier | .erb, .html.erb | `htmlbeautifier` command available |
30-
| air | .R | `air` command available |
31-
| dart | .dart | `dart` command available |
32-
| ocamlformat | .ml, .mli | `ocamlformat` command available and `.ocamlformat` config file |
3338
| terraform | .tf, .tfvars | `terraform` command available |
34-
| gleam | .gleam | `gleam` command available |
35-
| nixfmt | .nix | `nixfmt` command available |
36-
| shfmt | .sh, .bash | `shfmt` command available |
37-
| pint | .php | `laravel/pint` dependency in `composer.json` |
38-
| oxfmt (Experimental) | .js, .jsx, .ts, .tsx | `oxfmt` dependency in `package.json` and an [experimental env variable flag](/docs/cli/#experimental) |
39-
| ormolu | .hs | `ormolu` command available |
39+
| uv | .py, .pyi | `uv` command available |
40+
| zig | .zig, .zon | `zig` command available |
4041

4142
So if your project has `prettier` in your `package.json`, OpenCode will automatically use it.
4243

0 commit comments

Comments
 (0)