SofusA / roslyn-language-server

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

LSP Still Failing to Start on Windows #32

Closed lzned closed 1 month ago

lzned commented 1 month 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 1 month 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 1 month 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 1 month ago

Hmm this is weird.

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

lzned commented 1 month ago

Which version of roslyn-language-server?

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

SofusA commented 1 month 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?

lzned commented 1 month ago

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

Even still, the LSP doesn't work. The helix logs show this; 2024-10-01T09:50:33.608 helix_core::syntax [ERROR] TS parser failed, disabling TS for the current buffer: Err(Cancelled)

And what version of dotnet are you using?

I'm using dotnet 8.0.401

SofusA commented 1 month ago

I am using the same version.

I think that the first step is to get roslyn-language-server running without exceptions from Microsoft.CodeAnalysis.LanguageServer

Can you try with version 0.3.1?

Thanks for trying btw.

lzned commented 1 month ago

Can you try with version 0.3.1?

Running that version of roslyn only yields this in the helix log file:

2024-10-01T17:50:21.965 helix_core::syntax [ERROR] TS parser failed, disabling TS for the current buffer: Err(Cancelled)
2024-10-01T17:50:53.037 helix_lsp::transport [ERROR] Tried sending response into a closed channel (id=Num(3)), original request likely timed out
2024-10-01T17:50:53.037 helix_lsp::transport [ERROR] Tried sending response into a closed channel (id=Num(5)), original request likely timed out
2024-10-01T17:50:53.038 helix_lsp::transport [ERROR] Tried sending response into a closed channel (id=Num(2)), original request likely timed out
2024-10-01T17:50:53.038 helix_lsp::transport [ERROR] Tried sending response into a closed channel (id=Num(4)), original request likely timed out
2024-10-01T17:51:16.218 helix_lsp::transport [ERROR] Tried sending response into a closed channel (id=Num(2)), original request likely timed out
2024-10-01T17:51:16.329 helix_lsp::transport [ERROR] Tried sending response into a closed channel (id=Num(3)), original request likely timed out
2024-10-01T17:51:18.589 helix_lsp::transport [ERROR] Tried sending response into a closed channel (id=Num(10)), original request likely timed out
2024-10-01T17:51:18.592 helix_lsp::transport [ERROR] Tried sending response into a closed channel (id=Num(11)), original request likely timed out
2024-10-01T17:51:18.594 helix_lsp::transport [ERROR] Tried sending response into a closed channel (id=Num(13)), original request likely timed out
SofusA commented 1 month ago

I got i working in helix windows with version 0.4, so this must be something with your setup. I don't know Windows on a technical level, except running Steam, so i cant really help. I don't think your errors are related to this project.

You should be able to:

  1. Run roslyn-language-server without getting any errors, from the rust code, or exceptions from the C# code
  2. Run the official version of helix with this language server and get go to definitions
  3. Run with my fork and also get diagnostics.

I would debug in this order.

I am sorry i cant help more

lzned commented 1 month ago

I got i working in helix windows with version 0.4, so this must be something with your setup. I don't know Windows on a technical level, except running Steam, so i cant really help. I don't think your errors are related to this project.

You should be able to:

  1. Run roslyn-language-server without getting any errors, from the rust code, or exceptions from the C# code
  2. Run the official version of helix with this language server and get go to definitions
  3. Run with my fork and also get diagnostics.

I would debug in this order.

I am sorry i cant help more

If I can't get this working, in the meantime I'll probably use another IDE or editor. Thanks for all your help!