Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/opencode/src/lsp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ export namespace LSP {
}
} else {
// If experimental flag is disabled, disable ty
if (servers["ty"]) {
delete servers["ty"]
}
if (servers["ty"]) delete servers["ty"]
}
}

Expand Down
34 changes: 30 additions & 4 deletions packages/opencode/src/lsp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,6 @@ export namespace LSPServer {
"pyrightconfig.json",
]),
async spawn(root) {
if (!Flag.OPENCODE_EXPERIMENTAL_LSP_TY) {
return undefined
}

let binary = Bun.which("ty")

const initialization: Record<string, string> = {}
Expand Down Expand Up @@ -502,6 +498,36 @@ export namespace LSPServer {
},
}

export const Ruff: Info = {
id: "ruff",
extensions: [".py", ".pyi"],
root: NearestRoot([
"pyproject.toml",
"ruff.toml",
".ruff.toml",
"setup.py",
"setup.cfg",
"requirements.txt",
"Pipfile",
]),
async spawn(root) {
let binary = Bun.which("ruff")

if (!binary) {
log.error("ruff not found, please install ruff first")
return
}

const proc = spawn(binary, ["server"], {
cwd: root,
})

return {
process: proc,
}
},
}

export const Pyright: Info = {
id: "pyright",
extensions: [".py", ".pyi"],
Expand Down
Loading