omnisharp-roslyn: [LSP] `-lsp` option seems to be ignored

I want to start omnisharp-roslyn in LSP mode using stdio. I have installed : https://github.com/OmniSharp/omnisharp-roslyn/releases/download/v1.32.2/omnisharp-linux-x86.tar.gz When I run, I see output messages not conforming to LSP.

$ ./omnisharp/run -stdio -lsp

{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Stdio.Host","Message":"Starting OmniSharp on ubuntu 18.4 (x64)"},"Seq":1,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Services.DotNetCliService","Message":"DotNetPath set to dotnet"},"Seq":2,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.Discovery.MSBuildLocator","Message":"Located 1 MSBuild instance(s)\n        1: StandAlone 15.0 - \"/workspace/theia-csharp-extension/csharp/omnisharp/omnisharp/msbuild/15.0/Bin\""},"Seq":3,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.Discovery.MSBuildLocator","Message":"MSBUILD_EXE_PATH environment variable set to '/workspace/theia-csharp-extension/csharp/omnisharp/omnisharp/msbuild/15.0/Bin/MSBuild.dll'"},"Seq":4,"Type":"event"}
...

Connecting it to my client (Theia) doesn’t work either. The initialize request is sent but never answered. Seems like I am doing something wrong.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 21 (4 by maintainers)

Commits related to this issue

Most upvoted comments

https://github.com/OmniSharp/omnisharp-roslyn/blob/0496b7e914b70f18180d9c63b16eac7febc62708/src/OmniSharp.Stdio/StdioCommandLineApplication.cs#L19-L21

Change this to:

        public bool Stdio => true;

        public bool Lsp => _lsp.HasValue();

I don’t know if something changed with whatever is being used to parse command line arguments, but the actual value is set the null when dealing with a command line flag. You have to use the HasValue function to determine if the flag was set.

Since Stdio was always defaulting to true no matter what, just set it to true. And make Lsp check HasValue(). I’ve tested this and it works.

@Daniel-V1 Yeah, I submitted pull requests for two of my issues today. Of the remaining things I fixed, the URI one is not really a bug. Microsoft decided to not fix the issue because too many things were relying on the broken URIs so anybody who writes an LSP client has to manually fix the URI themselves. And I never got any guidance for the signature helper thing so I’m just keeping that locally for myself.