SofusA / roslyn-language-server

A wrapper around Roslyn language server which makes compatible with editors other than VSCode
MIT License
27 stars 4 forks source link

LSP Still Failing to Start on Windows #32

Open lzned opened 18 hours ago

lzned commented 18 hours ago

I don't know if this is a repeat of @celestialvigor's question, even though I did take the steps outlined at the bottom of their issue

My setup is practically the same as @celestialvigor's:

Steps taken: 1- put Microsoft.CodeAnalysis.LanguageServer in path. The exe is reachable from cmd. 2- ran: cargo install --git https://github.com/SofusA/roslyn-language-server 3- Uninstalled helix. Built your branch from source. 4- languages.toml:

However, these logs are generated when trying to use roslyn:

2024-09-30T15:02:58.792 helix_core::syntax [ERROR] TS parser failed, disabling TS for the current buffer: Err(Cancelled)
2024-09-30T15:03:33.873 helix_core::syntax [ERROR] TS parser failed, disabling TS for the current buffer: Err(Cancelled)
2024-09-30T15:04:06.879 helix_lsp [ERROR] failed to initialize language server: server closed the stream
2024-09-30T15:04:06.879 helix_lsp::transport [ERROR] taplo err: <- StreamClosed

Any idea on what's going on? Or does roslyn not support Windows (yet)?

SofusA commented 18 hours ago

Hey. Can you share your language.toml and share the output of just running roslyn-language-server?

I can verify later on my windows box

lzned commented 16 hours ago

Can you share your language.toml and share the output of just running roslyn-language-server?

Here's my languages.toml file configuration for C#:

[language-server.roslyn]
command = "roslyn-language-server"

[[language]]
name = "c-sharp"
injection-regex = "c-?sharp"
file-types = ["cs", "csx", "cake"]
roots = ["sln", "csproj"]
comment-token = "//"
block-comment-tokens = { start = "/*", end = "*/" }
indent = { tab-width = 4, unit = "\t" }
language-servers = [ "roslyn" ]
auto-format = true
formatter = {command = "dotnet", args = ["csharpier"]}

And here's the result of running roslyn-language-server through the command-line:

Content-Length: 116

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"[Program] Language server initialized"}}Unhandled exception: StreamJsonRpc.BadRpcHeaderException: No Content-Length header detected.
   at StreamJsonRpc.HeaderDelimitedMessageHandler.ReadCoreAsync(CancellationToken cancellationToken)
   at StreamJsonRpc.MessageHandlerBase.ReadAsync(CancellationToken cancellationToken)
   at StreamJsonRpc.JsonRpc.ReadAndHandleRequestsAsync()
   at Microsoft.CodeAnalysis.LanguageServer.LanguageServer.LanguageServerHost.WaitForExitAsync() in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/LanguageServerHost.cs:line 69
   at Program.<<Main>$>g__RunAsync|0_0(ServerConfiguration serverConfiguration, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Program.cs:line 143
   at Program.<<Main>$>g__RunAsync|0_0(ServerConfiguration serverConfiguration, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Program.cs:line 151
   at System.CommandLine.CliCommand.<>c__DisplayClass32_0.<<SetAction>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)

thread 'main' panicked at src/main.rs:87:18:
Unable to forward client notification to server: Os { code: 232, kind: BrokenPipe, message: "The pipe is being closed." }
SofusA commented 14 hours ago

Hmm this is weird.

Which version of roslyn-language-server ? (run roslyn-language-server --version

lzned commented 13 hours ago

Which version of roslyn-language-server?

Apparently, I'm using roslyn-language-server 0.4.0

SofusA commented 5 hours ago

I am able to run the version 0.4 from releases without any exceptions from the dll in windows, however I was not able to setup helix to use it though, but that is just a skill :laughing:

Can you try to create a new project with dotnet new console --use-program-main and try opening this project?

And what version of dotnet are you using?