Skip to content

feat: add roslyn lsp#6330

Open
seblyng wants to merge 1 commit intomason-org:mainfrom
seblyng:roslyn
Open

feat: add roslyn lsp#6330
seblyng wants to merge 1 commit intomason-org:mainfrom
seblyng:roslyn

Conversation

@seblyng
Copy link
Copy Markdown

@seblyng seblyng commented Jul 1, 2024

Describe your changes

This adds the roslyn language server from https://github.com/dotnet/roslyn/ which is a part of the C# dev kit in vscode.

Issue ticket number and link

Checklist before requesting a review

  • I have successfully tested installation of the package.
  • I have successfully tested the package after installation.

This language server doesn't start correctly by naively using it with nvim-lspconfig or vim.lsp.start. There needs to be a little bit of trickery to start it, since the server sends the pipe to communicate through, instead of allowing the client to name a pipe or communicate through stdio.

However, I have forked a plugin that started on this, and I am now maintaining it. I got this issue seblyng/roslyn.nvim#11 which asked if I would consider adding support for easier installation. The author of the issue created this repo https://github.com/Crashdummyy/roslynLanguageServer which gets a new version once a day.

This prompted me to think about adding it to mason, as it would really help with installation for me and whoever else is using the plugin😄

I tested to start it with my plugin, and it started just like it does when installing it manually. I also tested installation of all the different targets I added support for, and all of them was able to download just fine😄

Screenshots

@Conarius
Copy link
Copy Markdown
Contributor

Conarius commented Jul 1, 2024

Nice work though I don't think having the source file repo being different from the homepage url is a good idea as this will inevitably cause the downstream/upstream problem like users reporting bugs to the upstream project when it's a downstream issue and vice versa.
Though I might be a bit too cautious here and william might see things differently and would approve of it as it still is his decision

@seblyng
Copy link
Copy Markdown
Author

seblyng commented Jul 2, 2024

I can easily change the source url, no problem :)
I just went with it for now since I think I saw some other examples where this was done. I don't remember which package(s) this was from the top of mye head though

Comment thread packages/roslyn/package.yaml Outdated
@Kurren123
Copy link
Copy Markdown

Would be awesome to have this merged. Updating this manually is a pain.

@SimonSchwendele
Copy link
Copy Markdown

SimonSchwendele commented Aug 4, 2024

Would be awesome to have this merged. Updating this manually is a pain.

I wrote a bash script to update the lsp in the meantime.

You just have to replace targetDir and rid with your nvim datadir and the rid of your system

@616b2f
Copy link
Copy Markdown
Contributor

616b2f commented Aug 7, 2024

purl knows the concept of "repository_url" maybe this could be implemented for nuget, so we can reference the packages directly from microsoft repository?

@seblyng seblyng force-pushed the roslyn branch 2 times, most recently from e6860cb to 068f2c4 Compare August 22, 2024 17:17
@616b2f
Copy link
Copy Markdown
Contributor

616b2f commented Sep 3, 2024

FYI: I am currently working on providing a way to install "regular" (not dotnet tool) nuget packages, which would just download the plain nuget and extract it into a directory.

This would allow to also use "repository_url" to pull nuget images from custom registries, such as the one from microsoft.

The file for roslyn would then look like this:

name: roslyn
description: |
  The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
homepage: https://github.com/dotnet/roslyn
licenses:
  - MIT
languages:
  - C#
categories:
  - LSP

source:
  id: pkg:nuget/Microsoft.CodeAnalysis.LanguageServer.neutral@4.12.0-2.24419.4?repository_url=https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json
  download:
    file: Microsoft.CodeAnalysis.LanguageServer.neutral-{{version}}.nupkg

bin:
  roslyn: nuget:content/LanguageServer/neutral/Microsoft.CodeAnalysis.LanguageServer.dll

I will reference the PR as soon as I am finishing some cleanup.

Update package.yaml

Co-authored-by: SimonSchwendele <86782769+SimonSchwendele@users.noreply.github.com>
@seblyng
Copy link
Copy Markdown
Author

seblyng commented Sep 5, 2024

Sorry to ping you @williamboman

But is there anything else that I need to do? It seems like there is a lot of excitement for this, and I would really appreciate it if someone could review it so that we could (hopefully) get it merged😅 It would really make my life (and I guess others) easier to update the language server

@williamboman
Copy link
Copy Markdown
Member

williamboman commented Oct 22, 2024

Hey sorry for super late review, I see there's a lot of interest in this. I've had some reservations with this one because of:

  • Microsoft's Terms of Use explicitly prohibits redistributing software, although after some more reading I believe the MIT license with which this software is originally distributed under overrides this.
  • Unofficial sources are a last resort.
  • Releases are systematically removed in the Crashdummyy/roslynLanguageServer. This is especially problematic because of the frequent release cadence. I've been working on creating something similar to r-languageserver and julia-lsp for this but I won't have the time to finish it soon and I'd like to avoid pulling in more redistributions under mason-org.

Also as a side note, you can pretty easily create and use other registry sources. I see someone already provided an alternative registry for this so hopefully some people found that useful, also see https://github.com/williamboman/mason-registry-playground for a template for registries.

@Crashdummyy
Copy link
Copy Markdown

Hey sorry for super late review, I see there's a lot of interest in this. I've had some reservations with this one because of:

  • Microsoft's Terms of Use explicitly prohibits redistributing software, although after some more reading I believe the MIT license with which this software is originally distributed under overrides this.
  • Unofficial sources are a last resort.
  • Releases are systematically removed in the Crashdummyy/roslynLanguageServer. This is especially problematic because of the frequent release cadence. I've been working on creating something similar to r-languageserver and julia-lsp for this but I won't have the time to finish it soon and I'd like to avoid pulling in more redistributions under mason-org.

Also as a side note, you can pretty easily create and use other registry sources. I see someone already provided an alternative registry for this so hopefully some people found that useful, also see https://github.com/williamboman/mason-registry-playground for a template for registries.

I delete them frequently because I dont think its worth keeping them.
I will always keep the releases which are used in mason thats no issue on my side.

@seblyng
Copy link
Copy Markdown
Author

seblyng commented Oct 22, 2024

Alright! So if I understand you correctly, you are a bit hesitant to do it like this?

Is there something I could help with to make it available in core without depending on other third party registries?

@616b2f
Copy link
Copy Markdown
Contributor

616b2f commented Nov 17, 2024

Hey sorry for super late review, I see there's a lot of interest in this. I've had some reservations with this one because of:

* Microsoft's Terms of Use explicitly prohibits redistributing software, although after some more reading I believe the MIT license with which this software is originally distributed under overrides this.

* Unofficial sources are a last resort.

* Releases are systematically removed in the `Crashdummyy/roslynLanguageServer`. This is especially problematic because of the frequent release cadence. I've been working on creating something similar to [r-languageserver](https://github.com/mason-org/r-languageserver) and [julia-lsp](https://github.com/mason-org/julia-lsp) for this but I won't have the time to finish it soon and I'd like to avoid pulling in more redistributions under mason-org.

Also as a side note, you can pretty easily create and use other registry sources. I see someone already provided an alternative registry for this so hopefully some people found that useful, also see https://github.com/williamboman/mason-registry-playground for a template for registries.

What do you think about the #1781 PR, this would allow to use official Microsoft repository of the new Language Server, and any other repository then "nuget.org" in the future if needed. It also allow downloading nuget packages that are not "tools" but rather plain zip files. I can provide more Info about the rationals why this is not possible with the current way it's handled in mason.

@SonnyRR
Copy link
Copy Markdown

SonnyRR commented Feb 16, 2025

Would be great to have this LSP in the main repo. Setting up LSPs & configurations for C# is already a pain, so this would at least help streamline a part of the configuration steps.

@FurkanEmiroglu
Copy link
Copy Markdown

I really need this too.

@qoobes
Copy link
Copy Markdown

qoobes commented Mar 16, 2025

Can this please be merged in at some point?

@616b2f
Copy link
Copy Markdown
Contributor

616b2f commented Mar 16, 2025

I don't think this will ever be merged as is, because as the author of Maison already described here why it takes longer for the PRs to approve. Mason became a high value target for bad actors as the reach of any malicious binary would have a high reach. So merging in a 3rd party proxy repository of someone who is not known in the open source community is high risk. See for more info here:

mason-org/mason.nvim#1871 (comment)

I agree and understand completely. That's why I tried to suggest a solution where the original source can be used (which is controlled by Microsoft and it's the same source used by the official VS Code plugin for C# and therefore can be more trusted.

@Conarius
Copy link
Copy Markdown
Contributor

As far as I'm aware, omnisharp-roslyn already includes roslyn as well

@chrisgrieser chrisgrieser reopened this Jul 31, 2025
@chrisgrieser chrisgrieser added the blocked:mason-change-required a change at one the other mason repos is required label Aug 2, 2025
@dnperfors
Copy link
Copy Markdown

In the mean time Microsoft released the nuget packages on NuGet itself: https://www.nuget.org/packages/Microsoft.CodeAnalysis.LanguageServer.neutral/
Would that help in getting this PR approved?

@Crashdummyy
Copy link
Copy Markdown

In the mean time Microsoft released the nuget packages on NuGet itself: https://www.nuget.org/packages/Microsoft.CodeAnalysis.LanguageServer.neutral/ Would that help in getting this PR approved?

You had to get my hopes up 😆
They pubilshed one package 3 months ago.
Seems like just a mistake than like they planned to publish this in nuget.org

@616b2f
Copy link
Copy Markdown
Contributor

616b2f commented Aug 31, 2025

In the mean time Microsoft released the nuget packages on NuGet itself: https://www.nuget.org/packages/Microsoft.CodeAnalysis.LanguageServer.neutral/ Would that help in getting this PR approved?

You had to get my hopes up 😆
They pubilshed one package 3 months ago.
Seems like just a mistake than like they planned to publish this in nuget.org

Even if this were regularly published, it's not packaged in a "tools" format (see for my linked PR for more info on that), we still need to merge my PR first. I need just to fix the linting issues in it.

UPDATE: linting issues fixed if someone like to review the PR, I am happy to adopt it if necessary.

@ivanMosquedaFTP
Copy link
Copy Markdown

this would be so dang cool

@Rimann91
Copy link
Copy Markdown

Rimann91 commented Dec 4, 2025

would be very interested in this PR

@StevanFreeborn
Copy link
Copy Markdown

StevanFreeborn commented Dec 4, 2025

would be very interested in this PR

What @Rimann91 said

@Inurias
Copy link
Copy Markdown

Inurias commented Dec 6, 2025

would be very interested in this PR

Same :)

@RobinMeow
Copy link
Copy Markdown

is this being worked on currrently? i would love this aswell

@GalderioJaguara
Copy link
Copy Markdown

Would be nice,

@craigalodon
Copy link
Copy Markdown

I am interested as well.

@ZieMcd
Copy link
Copy Markdown

ZieMcd commented Feb 27, 2026

feel like this is relevant https://github.com/dotnet/roslyn/pull/82201/changes here.
Look like in future you can install lsp with dotnet tool install --global roslyn-language-server

@Crashdummyy
Copy link
Copy Markdown

feel like this is relevant https://github.com/dotnet/roslyn/pull/82201/changes here. Look like in future you can install lsp with dotnet tool install --global roslyn-language-server

That would be nice indeed as we wouldnt need mason at all anymore for this use case.
However this tool is currently missing the razor support.
Besides it does not get as frequent updates as the currently used languageserver.

We'll need to observe this for a bit longer to figure out microsoft grand plan

Comment on lines +14 to +30
id: pkg:github/Crashdummyy/roslynLanguageServer@4.12.0-3.24454.4
asset:
- target: darwin_x64
file: microsoft.codeanalysis.languageserver.osx-x64.zip:libexec/
- target: darwin_arm64
file: microsoft.codeanalysis.languageserver.osx-arm64.zip:libexec/
- target: linux_x64
file: microsoft.codeanalysis.languageserver.linux-x64.zip:libexec/
- target: linux_arm64
file: microsoft.codeanalysis.languageserver.linux-arm64.zip:libexec/
- target: win_x64
file: microsoft.codeanalysis.languageserver.win-x64.zip:libexec/
- target: win_arm64
file: microsoft.codeanalysis.languageserver.win-arm64.zip:libexec/

bin:
roslyn: dotnet:libexec/Microsoft.CodeAnalysis.LanguageServer.dll
Copy link
Copy Markdown
Contributor

@616b2f 616b2f Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id: pkg:github/Crashdummyy/roslynLanguageServer@4.12.0-3.24454.4
asset:
- target: darwin_x64
file: microsoft.codeanalysis.languageserver.osx-x64.zip:libexec/
- target: darwin_arm64
file: microsoft.codeanalysis.languageserver.osx-arm64.zip:libexec/
- target: linux_x64
file: microsoft.codeanalysis.languageserver.linux-x64.zip:libexec/
- target: linux_arm64
file: microsoft.codeanalysis.languageserver.linux-arm64.zip:libexec/
- target: win_x64
file: microsoft.codeanalysis.languageserver.win-x64.zip:libexec/
- target: win_arm64
file: microsoft.codeanalysis.languageserver.win-arm64.zip:libexec/
bin:
roslyn: dotnet:libexec/Microsoft.CodeAnalysis.LanguageServer.dll
source:
id: pkg:nuget/roslyn-language-server@5.5.0-2.26103.6
bin:
roslyn-language-server: nuget:roslyn-language-server

we can now use this, I tried it and it worked for me (using linux). Would be good if someone with MacOS and Windows could also try if this works as expected.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it would be nice if we could do this, but we also have no idea what the roslyn team is thinking about this release strategy. They have currently only released two versions, and the last one is over a month ago.

They did something similar almost a year ago with this. Released it once, and never again: https://www.nuget.org/packages/Microsoft.CodeAnalysis.LanguageServer.linux-x64/5.0.0-1.25277.114

I would like to get some more information from them about what their plans are for this, and if they plan on maintaining this. Also it would be nice if they had some information about what they are planning on doing for razor, but I cannot find any information about that, and this issue is currently unanswered: dotnet/roslyn#82535

Copy link
Copy Markdown
Contributor

@616b2f 616b2f Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference is that this time it's in the reamde of the official repository on the main branch, but sure we can wait of an official statement of the team

Copy link
Copy Markdown

@RobinMeow RobinMeow Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for opening it. i upvoted it.

anyone reading this being interested. go there and give it a thumbs_up to show microsoft we are being interested in this
dotnet/roslyn#82535

justinmk pushed a commit to neovim/nvim-lspconfig that referenced this pull request Mar 9, 2026
Problem:
As mentioned here (mason-org/mason-registry#6330 (comment)),
there is a change (https://github.com/dotnet/roslyn/pull/82201/changes) that the official language server can be
easily installed via `dotnet` cli.

Solution:
Use the official binary name as a fallback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked:mason-change-required a change at one the other mason repos is required

Projects

None yet

Development

Successfully merging this pull request may close these issues.