Skip to content
1 change: 1 addition & 0 deletions packages/opencode/src/lsp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export namespace LSP {
...process.env,
...item.env,
},
stdio: ["pipe", "pipe", "ignore"],
}),
initialization: item.initialization,
}
Expand Down
47 changes: 44 additions & 3 deletions packages/opencode/src/lsp/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ChildProcessWithoutNullStreams } from "child_process"
import { type ChildProcess } from "child_process"
import path from "path"
import os from "os"
import { Global } from "../global"
Expand Down Expand Up @@ -26,7 +26,7 @@ export namespace LSPServer {
const output = (cmd: string[], opts: Process.RunOptions = {}) => Process.text(cmd, { ...opts, nothrow: true })

export interface Handle {
process: ChildProcessWithoutNullStreams
process: ChildProcess
initialization?: Record<string, any>
}

Expand Down Expand Up @@ -87,6 +87,7 @@ export namespace LSPServer {
return {
process: spawn(deno, ["lsp"], {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand All @@ -109,6 +110,7 @@ export namespace LSPServer {
...process.env,
BUN_BE_BUN: "1",
},
stdio: ["pipe", "pipe", "ignore"],
})
return {
process: proc,
Expand Down Expand Up @@ -160,6 +162,7 @@ export namespace LSPServer {
...process.env,
BUN_BE_BUN: "1",
},
stdio: ["pipe", "pipe", "ignore"],
})
return {
process: proc,
Expand Down Expand Up @@ -220,6 +223,7 @@ export namespace LSPServer {
...process.env,
BUN_BE_BUN: "1",
},
stdio: ["pipe", "pipe", "ignore"],
})

return {
Expand Down Expand Up @@ -277,6 +281,7 @@ export namespace LSPServer {
return {
process: spawn(lintBin, ["--lsp"], {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
}
Expand All @@ -292,6 +297,7 @@ export namespace LSPServer {
return {
process: spawn(serverBin, [], {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
}
Expand Down Expand Up @@ -355,6 +361,7 @@ export namespace LSPServer {
...process.env,
BUN_BE_BUN: "1",
},
stdio: ["pipe", "pipe", "ignore"],
})

return {
Expand Down Expand Up @@ -399,6 +406,7 @@ export namespace LSPServer {
return {
process: spawn(bin!, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -439,6 +447,7 @@ export namespace LSPServer {
return {
process: spawn(bin!, ["--lsp"], {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -499,6 +508,7 @@ export namespace LSPServer {

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

return {
Expand Down Expand Up @@ -554,6 +564,7 @@ export namespace LSPServer {
...process.env,
BUN_BE_BUN: "1",
},
stdio: ["pipe", "pipe", "ignore"],
})
return {
process: proc,
Expand Down Expand Up @@ -620,6 +631,7 @@ export namespace LSPServer {
return {
process: spawn(binary, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -732,6 +744,7 @@ export namespace LSPServer {
return {
process: spawn(bin, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -771,6 +784,7 @@ export namespace LSPServer {
return {
process: spawn(bin, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -810,6 +824,7 @@ export namespace LSPServer {
return {
process: spawn(bin, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand All @@ -827,6 +842,7 @@ export namespace LSPServer {
return {
process: spawn(sourcekit, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
}
Expand All @@ -844,6 +860,7 @@ export namespace LSPServer {
return {
process: spawn(bin, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -890,6 +907,7 @@ export namespace LSPServer {
return {
process: spawn(bin, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand All @@ -906,6 +924,7 @@ export namespace LSPServer {
return {
process: spawn(fromPath, args, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
}
Expand All @@ -916,6 +935,7 @@ export namespace LSPServer {
return {
process: spawn(direct, args, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
}
Expand All @@ -929,6 +949,7 @@ export namespace LSPServer {
return {
process: spawn(candidate, args, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
}
Expand Down Expand Up @@ -1036,6 +1057,7 @@ export namespace LSPServer {
return {
process: spawn(bin, args, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -1073,6 +1095,7 @@ export namespace LSPServer {
...process.env,
BUN_BE_BUN: "1",
},
stdio: ["pipe", "pipe", "ignore"],
})
return {
process: proc,
Expand Down Expand Up @@ -1120,6 +1143,7 @@ export namespace LSPServer {
...process.env,
BUN_BE_BUN: "1",
},
stdio: ["pipe", "pipe", "ignore"],
})
return {
process: proc,
Expand Down Expand Up @@ -1247,6 +1271,7 @@ export namespace LSPServer {
],
{
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
},
),
}
Expand Down Expand Up @@ -1347,6 +1372,7 @@ export namespace LSPServer {
return {
process: spawn(launcherScript, ["--stdio"], {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -1393,6 +1419,7 @@ export namespace LSPServer {
...process.env,
BUN_BE_BUN: "1",
},
stdio: ["pipe", "pipe", "ignore"],
})
return {
process: proc,
Expand Down Expand Up @@ -1538,6 +1565,7 @@ export namespace LSPServer {
return {
process: spawn(bin, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -1575,6 +1603,7 @@ export namespace LSPServer {
...process.env,
BUN_BE_BUN: "1",
},
stdio: ["pipe", "pipe", "ignore"],
})
return {
process: proc,
Expand All @@ -1600,6 +1629,7 @@ export namespace LSPServer {
return {
process: spawn(prisma, ["language-server"], {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand All @@ -1618,6 +1648,7 @@ export namespace LSPServer {
return {
process: spawn(dart, ["language-server", "--lsp"], {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand All @@ -1636,6 +1667,7 @@ export namespace LSPServer {
return {
process: spawn(bin, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -1672,6 +1704,7 @@ export namespace LSPServer {
...process.env,
BUN_BE_BUN: "1",
},
stdio: ["pipe", "pipe", "ignore"],
})
return {
process: proc,
Expand Down Expand Up @@ -1751,6 +1784,7 @@ export namespace LSPServer {
return {
process: spawn(bin, ["serve"], {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
initialization: {
experimentalFeatures: {
Expand Down Expand Up @@ -1847,6 +1881,7 @@ export namespace LSPServer {
return {
process: spawn(bin, {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -1884,6 +1919,7 @@ export namespace LSPServer {
...process.env,
BUN_BE_BUN: "1",
},
stdio: ["pipe", "pipe", "ignore"],
})
return {
process: proc,
Expand All @@ -1904,6 +1940,7 @@ export namespace LSPServer {
return {
process: spawn(gleam, ["lsp"], {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand All @@ -1925,6 +1962,7 @@ export namespace LSPServer {
return {
process: spawn(bin, ["listen"], {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -1956,6 +1994,7 @@ export namespace LSPServer {
env: {
...process.env,
},
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down Expand Up @@ -2050,7 +2089,7 @@ export namespace LSPServer {
}

return {
process: spawn(bin, { cwd: root }),
process: spawn(bin, { cwd: root, stdio: ["pipe", "pipe", "ignore"] }),
}
},
}
Expand All @@ -2068,6 +2107,7 @@ export namespace LSPServer {
return {
process: spawn(bin, ["--lsp"], {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand All @@ -2086,6 +2126,7 @@ export namespace LSPServer {
return {
process: spawn(julia, ["--startup-file=no", "--history-file=no", "-e", "using LanguageServer; runserver()"], {
cwd: root,
stdio: ["pipe", "pipe", "ignore"],
}),
}
},
Expand Down
Loading