Skip to content

Commit 5e9fb3c

Browse files
jmbryan4Mathews
andauthored
feat: replace csharp-ls with roslyn-language-server (#14463)
Co-authored-by: Mathews <[email protected]>
1 parent 2da6d86 commit 5e9fb3c

1 file changed

Lines changed: 22 additions & 12 deletions

File tree

packages/opencode/src/lsp/server.ts

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -705,32 +705,42 @@ export const CSharp: Info = {
705705
root: NearestRoot([".slnx", ".sln", ".csproj", "global.json"]),
706706
extensions: [".cs"],
707707
async spawn(root) {
708-
let bin = which("csharp-ls")
708+
let bin = which("roslyn-language-server")
709709
if (!bin) {
710710
if (!which("dotnet")) {
711-
log.error(".NET SDK is required to install csharp-ls")
711+
log.error(".NET SDK is required to install roslyn-language-server")
712712
return
713713
}
714714

715715
if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
716-
log.info("installing csharp-ls via dotnet tool")
717-
const proc = Process.spawn(["dotnet", "tool", "install", "csharp-ls", "--tool-path", Global.Path.bin], {
718-
stdout: "pipe",
719-
stderr: "pipe",
720-
stdin: "pipe",
721-
})
716+
log.info("installing roslyn-language-server via dotnet tool")
717+
const proc = Process.spawn(
718+
[
719+
"dotnet",
720+
"tool",
721+
"install",
722+
"--global",
723+
"roslyn-language-server",
724+
"--prerelease",
725+
],
726+
{
727+
stdout: "pipe",
728+
stderr: "pipe",
729+
stdin: "pipe",
730+
},
731+
)
722732
const exit = await proc.exited
723733
if (exit !== 0) {
724-
log.error("Failed to install csharp-ls")
734+
log.error("Failed to install roslyn-language-server")
725735
return
726736
}
727737

728-
bin = path.join(Global.Path.bin, "csharp-ls" + (process.platform === "win32" ? ".exe" : ""))
729-
log.info(`installed csharp-ls`, { bin })
738+
bin = path.join(Global.Path.bin, "roslyn-language-server" + (process.platform === "win32" ? ".exe" : ""))
739+
log.info(`installed roslyn-language-server`, { bin })
730740
}
731741

732742
return {
733-
process: spawn(bin, {
743+
process: spawn(bin, ["--stdio", "--autoLoadProjects"], {
734744
cwd: root,
735745
}),
736746
}

0 commit comments

Comments
 (0)