mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-22 18:24:21 +01:00
Add support for uv format in formatters (#3916)
This commit is contained in:
@@ -177,6 +177,21 @@ export const ruff: Info = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const uvformat: Info = {
|
||||||
|
name: "uv format",
|
||||||
|
command: ["uv", "format", "--", "$FILE"],
|
||||||
|
extensions: [".py", ".pyi"],
|
||||||
|
async enabled() {
|
||||||
|
if (await ruff.enabled()) return false
|
||||||
|
if (Bun.which("uv") !== null) {
|
||||||
|
const proc = Bun.spawn(["uv", "format", "--help"], { stderr: "pipe", stdout: "pipe" })
|
||||||
|
const code = await proc.exited
|
||||||
|
return code === 0
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
export const rubocop: Info = {
|
export const rubocop: Info = {
|
||||||
name: "rubocop",
|
name: "rubocop",
|
||||||
command: ["rubocop", "--autocorrect", "$FILE"],
|
command: ["rubocop", "--autocorrect", "$FILE"],
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ OpenCode comes with several built-in formatters for popular languages and framew
|
|||||||
| clang-format | .c, .cpp, .h, .hpp, .ino, and [more](https://clang.llvm.org/docs/ClangFormat.html) | `.clang-format` config file |
|
| clang-format | .c, .cpp, .h, .hpp, .ino, and [more](https://clang.llvm.org/docs/ClangFormat.html) | `.clang-format` config file |
|
||||||
| ktlint | .kt, .kts | `ktlint` command available |
|
| ktlint | .kt, .kts | `ktlint` command available |
|
||||||
| ruff | .py, .pyi | `ruff` command available with config |
|
| ruff | .py, .pyi | `ruff` command available with config |
|
||||||
|
| uv | .py, .pyi | `uv` command available |
|
||||||
| rubocop | .rb, .rake, .gemspec, .ru | `rubocop` command available |
|
| rubocop | .rb, .rake, .gemspec, .ru | `rubocop` command available |
|
||||||
| standardrb | .rb, .rake, .gemspec, .ru | `standardrb` command available |
|
| standardrb | .rb, .rake, .gemspec, .ru | `standardrb` command available |
|
||||||
| htmlbeautifier | .erb, .html.erb | `htmlbeautifier` command available |
|
| htmlbeautifier | .erb, .html.erb | `htmlbeautifier` command available |
|
||||||
|
|||||||
Reference in New Issue
Block a user