Repository navigation
Switch C# to Roslyn and add build-then-debug - #17
Merged
Merged
Conversation
- roslyn.nvim runs Roslyn, the server VS Code's C# extension uses, instead of csharp-ls. It's installed through Mason from Microsoft's nuget.org package, pinned because Mason's registry default is older than roslyn.nvim supports. Inlay hint settings keep <leader>ih working. - mason-lspconfig no longer installs csharp_ls and excludes roslyn_ls and csharp_ls from automatic_enable, so only one C# client attaches (an existing csharp-ls install would otherwise still start). - simonkdev/dotnet.lua replaces mason-nvim-dap's "pick any DLL under bin/Debug" config with "Build and debug a project": it lists the solution's runnable projects (last pick first), builds the chosen one for its newest .NET target (netcoredbg can't debug .NET Framework), sends build errors to quickfix, and launches the TargetPath MSBuild reports, with the project directory as cwd like `dotnet run`. It runs as the coreclr adapter's enrich_config, so neotest's test debugging is unaffected. - Smoke test checks the roslyn client is enabled and roslyn_ls and csharp_ls are excluded. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 90315f97-7c82-4bc1-9bf1-2f8460782554
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switches C# from csharp-ls to Roslyn and makes debugging build first and pick the right project.
Language server
.slnxsupport,:Roslyn targetto switch solutions.roslyn-language-serverpackage on nuget.org, pinned to5.13.0-1.26514.10(newer than VS Code's). Mason's registry default (5.12.0-1.26426.8) is older than roslyn.nvim's minimum, and I avoided the third-party registry the plugin suggests. The plugin update workflow won't bump this pin.csharp_lsand excludesroslyn_ls/csharp_lsfromautomatic_enable, otherwise the Mason package (or a leftover csharp-ls install) would attach a second C# client.<leader>ihworks for C#.Debugging (
lua/simonkdev/dotnet.lua):<leader>dcin a C# file → Build and debug a projectOutputTypeExe/WinExe, Web/Worker SDK; all projects if none match), last pick firstnet472)dotnet build; on failure the errors go to quickfix and no session startsTargetPathwith the project directory as cwd, likedotnet runenrich_config, so neotest's test debugging (also coreclr) is unchanged.Tested locally on 0.12.6 with a throwaway
.slnx(console app,net472;net10.0console app, class library):roslynclient attached and selected the.slnx; cross-file go-to-definition, inlay hints, and format + trailing-whitespace trim all worknet10.0, stopped at a breakpoint, showed the stack and evaluated a localAfter merging, I'll pull it into your live config and uninstall the Mason csharp-language-server package.