summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-06-29 21:25:32 -0400
committerDax Raad <[email protected]>2025-06-29 21:27:35 -0400
commit463257e7e453ea17997247d3ffe18b981df1d7f2 (patch)
tree3a86e4a1219db6da845b7137c712790e46d6356f /packages
parent0f41e60bd61939a3cc35518d8493b2d1aad6e223 (diff)
downloadopencode-463257e7e453ea17997247d3ffe18b981df1d7f2.tar.gz
opencode-463257e7e453ea17997247d3ffe18b981df1d7f2.zip
add zig, python, clang, and kotlin formatters
Co-authored-by: Suhas-Koheda <[email protected]> Co-authored-by: Polo123456789 <[email protected]> Co-authored-by: theodore-s-beers <[email protected]> Co-authored-by: TylerHillery <[email protected]>
Diffstat (limited to 'packages')
-rw-r--r--packages/opencode/src/format/formatters.ts50
1 files changed, 50 insertions, 0 deletions
diff --git a/packages/opencode/src/format/formatters.ts b/packages/opencode/src/format/formatters.ts
index ec4362b68..e1235282b 100644
--- a/packages/opencode/src/format/formatters.ts
+++ b/packages/opencode/src/format/formatters.ts
@@ -74,3 +74,53 @@ export const prettier: Definition = {
}
},
}
+
+export const zig: Definition = {
+ name: "zig",
+ command: ["zig", "fmt", "$FILE"],
+ extensions: [".zig", ".zon"],
+ async enabled() {
+ return Bun.which("zig") !== null
+ },
+}
+
+export const clang: Definition = {
+ name: "clang-format",
+ command: ["clang-format", "-i", "$FILE"],
+ extensions: [
+ ".c",
+ ".cc",
+ ".cpp",
+ ".cxx",
+ ".c++",
+ ".h",
+ ".hh",
+ ".hpp",
+ ".hxx",
+ ".h++",
+ ".ino",
+ ".C",
+ ".H",
+ ],
+ async enabled() {
+ return Bun.which("clang-format") !== null
+ },
+}
+
+export const ktlint: Definition = {
+ name: "ktlint",
+ command: ["ktlint", "-F", "$FILE"],
+ extensions: [".kt", ".kts"],
+ async enabled() {
+ return Bun.which("ktlint") !== null
+ },
+}
+
+export const ruff: Definition = {
+ name: "ruff",
+ command: ["ruff", "format", "$FILE"],
+ extensions: [".py", ".pyi"],
+ async enabled() {
+ return Bun.which("ruff") !== null
+ },
+}