I use Neovim btw...
Unfortunately, I'm also a C# developer.
Anyone who has used .NET in Neovim knows that the language support is tenuous. I've spent hours tweaking my configuration to get the roslyn LSP to interact with my code editor, and I could never get the limited feature set that I wanted to feel smooth and native the way other LSPs do in Neovim... especially razor.
That is... until now.
A few weeks ago with this commit, the developers of the roslyn.nvim plugin made it so much easier to get up and running with the roslyn server that's officially distributed by Microsoft.
Early this year, Microsoft put out a prerelease of a new dotnet CLI tool roslyn-language-server. Before this release, developers got access to the server by downloading the binaries from an obscure azure feed and pointing the Neovim plugin to the proper dll. Some adventurous and patient developers even got razor support in this method, but I was not one of them.
With an officially (pre-) released tool from Microsoft, downloading roslyn is now as easy as running:
dotnet tool install -g roslyn-language-server --prerelease
After a month or two, the developers of roslyn.nvim updated the plugin to support the new roslyn-language-server command to setup the plugin. They even set the plugin to search for it on a fallback by default, so no configuration changes are required.
My configuration for roslyn.nvim used to be about 20 lines of Lua. Here it is now:
{
'seblyng/roslyn.nvim',
---@module 'roslyn.config'
---@type RoslynNvimConfig
opts = {},
},
It's Simple. It works.
Large projects initialize relatively quickly, and all of the standard language server operations, like semantic highlighting, renaming, jump to definition/implementation, in-editor diagnostics, etc. are available out of the box.
I'm not exactly sure what magic the developers pulled here, but as I've mentioned, I've never gotten razor syntax support. With the recent updates, razor is supported!
I've been using this setup for about a month now, and it's been smooth and performant. I still have to restart the server somewhat frequently on large, sprawling solutions that have several projects, but development is still active on this plugin, and I expect to see improvements here soon!
If you've been holding off from switching to Neovim because of C# and razor support, your wait might be over. Give the plugin a try and see if your old frustrations are gone.
Top comments (3)
Hey,
Great write-up.
Roslyn in Neovim always felt like the one remaining “rough edge” in the .NET + editor setup, especially with Razor. The new CLI-based setup definitely seems like it removes a lot of friction.
I’ve been experimenting with similar setups recently and still see large-solution startup time as the main bottleneck.
Curious if you’ve tried this with bigger multi-project solutions yet.
Absolutely still a bottleneck. Most of the solutions I work on have 5+ projects and the initialization time is a bit longer. I'm not sure how much improvement to expect here considering 10-20sec Visual Studio startup times. I'm hoping that we can get quicker initialization and a bit more persistent attachment to buffers over the next few months!
Thank you, Nolan.
I see that you are so experienced. So I have one idea and I wanna collaborate with you.
Are you interested? Please let me know.