A wrapper around the language server behind the C# Visual Studio Code extension, Microsoft.CodeAnalysis.LanguageServer
, which makes it compatible with other editors, e.g., Helix.
This is more stable and faster than OmniSharp.
This has only been tested on Linux.
This tool works around the quirks of Microsoft.CodeAnalysis.LanguageServer
in the following way:
- Launches
Microsoft.CodeAnalysis.LanguageServer
as a process - Passes the provided
unix socket
and forwards all communication tostdio
- Waits for
Capabilities
notification from server- Forces
pull diagnostics
to be available. This is a hack to make the server respect clients who does not support dynamic regisration of diagnostic capabilities. This is should be considered a bug in the server and can hopefully be removed with a future version of server
- Forces
- Waits for an
Initialize
notification from the client- Finds relevant
.sln
or.csproj
files and sends them to the server as anopen
notification.
- Finds relevant
The wrapper uses Microsoft.CodeAnalysis.LanguageServer
so you need this on your path.
If you use nix
, you can grab nixpkgs.roslyn-ls
.
Otherwise:
- Find and download
Microsoft.CodeAnalysis.LanguageServer
for your architecture at the public feed. - Unzip the
.nupkg
file withunzip
- Find and move the
Microsoft.CodeAnalysis.LanguageServer
executable to a directory on your path, e.g.,~/.local/bin
.
If you use nix
, you can use this repository's nix flake
.
Alternatively, install with cargo
: cargo install --git https://github.com/SofusA/roslyn-language-server
Since Microsoft.CodeAnalysis.LanguageServer
only supports pull diagnostics
and Helix does not (yet), you would need to use my branch at github:sofusa/helix-pull-diagnostics
.
[language-server.roslyn]
command = "roslyn-language-server"
[[language]]
name = "c-sharp"
language-servers = ["roslyn"]