feat: replace csharp-ls with roslyn-language-server (#14463)
Co-authored-by: Mathews <Mathews.Bryan@cincpro.com>
This commit is contained in:
@@ -705,32 +705,42 @@ export const CSharp: Info = {
|
|||||||
root: NearestRoot([".slnx", ".sln", ".csproj", "global.json"]),
|
root: NearestRoot([".slnx", ".sln", ".csproj", "global.json"]),
|
||||||
extensions: [".cs"],
|
extensions: [".cs"],
|
||||||
async spawn(root) {
|
async spawn(root) {
|
||||||
let bin = which("csharp-ls")
|
let bin = which("roslyn-language-server")
|
||||||
if (!bin) {
|
if (!bin) {
|
||||||
if (!which("dotnet")) {
|
if (!which("dotnet")) {
|
||||||
log.error(".NET SDK is required to install csharp-ls")
|
log.error(".NET SDK is required to install roslyn-language-server")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
|
if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
|
||||||
log.info("installing csharp-ls via dotnet tool")
|
log.info("installing roslyn-language-server via dotnet tool")
|
||||||
const proc = Process.spawn(["dotnet", "tool", "install", "csharp-ls", "--tool-path", Global.Path.bin], {
|
const proc = Process.spawn(
|
||||||
stdout: "pipe",
|
[
|
||||||
stderr: "pipe",
|
"dotnet",
|
||||||
stdin: "pipe",
|
"tool",
|
||||||
})
|
"install",
|
||||||
|
"--global",
|
||||||
|
"roslyn-language-server",
|
||||||
|
"--prerelease",
|
||||||
|
],
|
||||||
|
{
|
||||||
|
stdout: "pipe",
|
||||||
|
stderr: "pipe",
|
||||||
|
stdin: "pipe",
|
||||||
|
},
|
||||||
|
)
|
||||||
const exit = await proc.exited
|
const exit = await proc.exited
|
||||||
if (exit !== 0) {
|
if (exit !== 0) {
|
||||||
log.error("Failed to install csharp-ls")
|
log.error("Failed to install roslyn-language-server")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
bin = path.join(Global.Path.bin, "csharp-ls" + (process.platform === "win32" ? ".exe" : ""))
|
bin = path.join(Global.Path.bin, "roslyn-language-server" + (process.platform === "win32" ? ".exe" : ""))
|
||||||
log.info(`installed csharp-ls`, { bin })
|
log.info(`installed roslyn-language-server`, { bin })
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
process: spawn(bin, {
|
process: spawn(bin, ["--stdio", "--autoLoadProjects"], {
|
||||||
cwd: root,
|
cwd: root,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user