From 238b86daeb8ce015c0e44d9eb9888f56b0b45510 Mon Sep 17 00:00:00 2001 From: Cool-Game-Dev Date: Tue, 12 Aug 2025 13:42:40 -0500 Subject: [PATCH 1/3] languages/csharp: Add roslyn-ls Add the roslyn-ls lsp to the csharp language model, following standards set by other lsps. --- modules/plugins/languages/csharp.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/plugins/languages/csharp.nix b/modules/plugins/languages/csharp.nix index a9708cae..0740a779 100644 --- a/modules/plugins/languages/csharp.nix +++ b/modules/plugins/languages/csharp.nix @@ -126,11 +126,27 @@ AutomaticWorkspaceInit = true; }; }; + + roslyn_ls = { + cmd = mkLuaInline '' + { + ${toLuaObject (getExe pkgs.roslyn-ls)}, + '--logLevel=Warning', + '--extensionLogDirectory=' .. vim.fs.dirname(vim.lsp.get_log_path()), + '--stdio', + } + ''; + + filetypes = ["cs"]; + root_markers = [".sln" ".csproj" ".editorconfig"]; + init_options = {}; + }; }; extraServerPlugins = { omnisharp = ["omnisharp-extended-lsp-nvim"]; csharp_ls = ["csharpls-extended-lsp-nvim"]; + roslyn_ls = []; }; cfg = config.vim.languages.csharp; From 15b9e653688caf557e1b6a84306b4078d75d8cef Mon Sep 17 00:00:00 2001 From: Cool-Game-Dev Date: Tue, 12 Aug 2025 13:47:28 -0500 Subject: [PATCH 2/3] add release notes entry Add entry for roslyn-ls to the release notes. --- docs/release-notes/rl-0.8.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 367cd835..cc2df92e 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -477,5 +477,8 @@ [Cool-Game-Dev](https://github.com/Cool-Game-Dev): [just-lsp]: https://github.com/terror/just-lsp +[roslyn-ls]: https://github.com/dotnet/vscode-csharp - Add just support under `vim.languages.just` using [just-lsp]. + +- Add [roslyn-ls] to the `vim.languages.csharp` module. From 9eb060dde2dcd99219f3c2cfb068d7316590dbb9 Mon Sep 17 00:00:00 2001 From: Cool-Game-Dev Date: Wed, 13 Aug 2025 09:03:09 -0500 Subject: [PATCH 3/3] languages/csharp: Replace root_markers with root_dir Replace the root_markers with root_dir in roslyn_ls and omnisharp --- modules/plugins/languages/csharp.nix | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/modules/plugins/languages/csharp.nix b/modules/plugins/languages/csharp.nix index 0740a779..9e13a5ef 100644 --- a/modules/plugins/languages/csharp.nix +++ b/modules/plugins/languages/csharp.nix @@ -43,7 +43,18 @@ } ''; filetypes = ["cs" "vb"]; - root_markers = [".sln" ".csproj" "omnisharp.json" "function.json"]; + root_dir = mkLuaInline '' + function(bufnr, on_dir) + local function find_root_pattern(fname, lua_pattern) + return vim.fs.root(0, function(name, path) + return name:match(lua_pattern) + end) + end + + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(find_root_pattern(fname, "%.sln$") or find_root_pattern(fname, "%.csproj$")) + end + ''; init_options = {}; capabilities = { workspace = { @@ -138,7 +149,18 @@ ''; filetypes = ["cs"]; - root_markers = [".sln" ".csproj" ".editorconfig"]; + root_dir = mkLuaInline '' + function(bufnr, on_dir) + local function find_root_pattern(fname, lua_pattern) + return vim.fs.root(0, function(name, path) + return name:match(lua_pattern) + end) + end + + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(find_root_pattern(fname, "%.sln$") or find_root_pattern(fname, "%.csproj$")) + end + ''; init_options = {}; }; };