Skip to content

Commit 78c62ac

Browse files
committed
Add ocamlformat-mlx formatter support for .mlx files
1 parent 06f25c7 commit 78c62ac

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

packages/opencode/src/format/formatter.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,17 @@ export const ocamlformat: Info = {
293293
},
294294
}
295295

296+
export const ocamlformat_mlx: Info = {
297+
name: "ocamlformat-mlx",
298+
command: ["ocamlformat-mlx", "-i", "$FILE"],
299+
extensions: [".mlx"],
300+
async enabled() {
301+
if (!Bun.which("ocamlformat-mlx")) return false
302+
const items = await Filesystem.findUp(".ocamlformat", Instance.directory, Instance.worktree)
303+
return items.length > 0
304+
},
305+
}
306+
296307
export const terraform: Info = {
297308
name: "terraform",
298309
command: ["terraform", "fmt", "$FILE"],

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ OpenCode comes with several built-in formatters for popular languages and framew
2727
| mix | .ex, .exs, .eex, .heex, .leex, .neex, .sface | `mix` command available |
2828
| nixfmt | .nix | `nixfmt` command available |
2929
| ocamlformat | .ml, .mli | `ocamlformat` command available and `.ocamlformat` config file |
30+
| ocamlformat-mlx | .mlx | `ocamlformat-mlx` command available and `.ocamlformat` config file |
3031
| ormolu | .hs | `ormolu` command available |
3132
| oxfmt (Experimental) | .js, .jsx, .ts, .tsx | `oxfmt` dependency in `package.json` and an [experimental env variable flag](/docs/cli/#experimental) |
3233
| pint | .php | `laravel/pint` dependency in `composer.json` |

0 commit comments

Comments
 (0)