diff options
| author | rari404 <[email protected]> | 2025-12-08 12:39:49 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-08 11:39:49 -0600 |
| commit | 9bd2ea5e5f5cd890d85ea8ac18dda14b0da1ba38 (patch) | |
| tree | e06c34c39207fdc275092355e11b1d15a7514461 | |
| parent | aa525482ae5b16125abf22ffe95b85f88dcab6db (diff) | |
| download | opencode-9bd2ea5e5f5cd890d85ea8ac18dda14b0da1ba38.tar.gz opencode-9bd2ea5e5f5cd890d85ea8ac18dda14b0da1ba38.zip | |
feat: add bash-language-server LSP (#5246)
| -rw-r--r-- | packages/opencode/src/lsp/server.ts | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/packages/opencode/src/lsp/server.ts b/packages/opencode/src/lsp/server.ts index ce2fbfa69..7b250c581 100644 --- a/packages/opencode/src/lsp/server.ts +++ b/packages/opencode/src/lsp/server.ts @@ -1184,4 +1184,43 @@ export namespace LSPServer { } }, } + + export const BashLS: Info = { + id: "bash", + extensions: [".sh", ".bash", ".zsh", ".ksh"], + root: async () => Instance.directory, + async spawn(root) { + let binary = Bun.which("bash-language-server") + const args: string[] = [] + if (!binary) { + const js = path.join(Global.Path.bin, "node_modules", "bash-language-server", "out", "cli.js") + if (!(await Bun.file(js).exists())) { + if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return + await Bun.spawn([BunProc.which(), "install", "bash-language-server"], { + cwd: Global.Path.bin, + env: { + ...process.env, + BUN_BE_BUN: "1", + }, + stdout: "pipe", + stderr: "pipe", + stdin: "pipe", + }).exited + } + binary = BunProc.which() + args.push("run", js) + } + args.push("start") + const proc = spawn(binary, args, { + cwd: root, + env: { + ...process.env, + BUN_BE_BUN: "1", + }, + }) + return { + process: proc, + } + }, + } } |
