|
@@ -337,6 +337,23 @@ export const rustfmt: Info = {
|
|
|
command: ["rustfmt", "$FILE"],
|
|
command: ["rustfmt", "$FILE"],
|
|
|
extensions: [".rs"],
|
|
extensions: [".rs"],
|
|
|
async enabled() {
|
|
async enabled() {
|
|
|
- return Bun.which("rustfmt") !== null
|
|
|
|
|
|
|
+ if (!Bun.which("rustfmt")) return false
|
|
|
|
|
+ const configs = ["rustfmt.toml", ".rustfmt.toml"]
|
|
|
|
|
+ for (const config of configs) {
|
|
|
|
|
+ const found = await Filesystem.findUp(config, Instance.directory, Instance.worktree)
|
|
|
|
|
+ if (found.length > 0) return true
|
|
|
|
|
+ }
|
|
|
|
|
+ return false
|
|
|
|
|
+ },
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export const cargofmt: Info = {
|
|
|
|
|
+ name: "cargo fmt",
|
|
|
|
|
+ command: ["cargo", "fmt", "--", "$FILE"],
|
|
|
|
|
+ extensions: [".rs"],
|
|
|
|
|
+ async enabled() {
|
|
|
|
|
+ if (!Bun.which("cargo")) return false
|
|
|
|
|
+ const found = await Filesystem.findUp("Cargo.toml", Instance.directory, Instance.worktree)
|
|
|
|
|
+ return found.length > 0
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|