languages/csharp: add csharpls-extended-lsp-nvim extension

This commit is contained in:
CaueAnjos 2026-04-18 11:51:44 -03:00
commit 1628aa93b7
2 changed files with 26 additions and 10 deletions

View file

@ -112,6 +112,7 @@
- Renamed `roslyn_ls` to `roslyn-ls` - Renamed `roslyn_ls` to `roslyn-ls`
- Turned `omnisharp-extended-lsp-nvim` into an extension disabled by default - Turned `omnisharp-extended-lsp-nvim` into an extension disabled by default
- Turned `csharpls-extended-lsp-nvim` into an extension disabled by default
## Changelog {#sec-release-0-9-changelog} ## Changelog {#sec-release-0-9-changelog}

View file

@ -5,7 +5,6 @@
options, options,
... ...
}: let }: let
inherit (builtins) concatMap;
inherit (builtins) elem; inherit (builtins) elem;
inherit (lib) genAttrs; inherit (lib) genAttrs;
inherit (lib.generators) mkLuaInline; inherit (lib.generators) mkLuaInline;
@ -18,13 +17,8 @@
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.binds) addDescriptionsToMappings; inherit (lib.nvim.binds) addDescriptionsToMappings;
extraServerPlugins = { defaultServers = ["csharp_ls"];
csharp_ls = ["csharpls-extended-lsp-nvim"]; servers = ["csharp_ls" "omnisharp" "roslyn-ls"];
roslyn-ls = [];
omnisharp = [];
};
defaultServers = ["csharp-ls"];
servers = ["csharp-ls" "omnisharp" "roslyn-ls"];
cfg = config.vim.languages.csharp; cfg = config.vim.languages.csharp;
in { in {
@ -35,7 +29,7 @@ in {
::: {.note} ::: {.note}
This feature will not work if the .NET SDK is not installed. This feature will not work if the .NET SDK is not installed.
Both `roslyn-ls` (with `roslyn-nvim`) and `csharp-ls` require the .NET SDK to function properly with Razor. Both `roslyn-ls` (with `roslyn-nvim`) and `csharp_ls` require the .NET SDK to function properly with Razor.
Ensure that the .NET SDK is installed. Ensure that the .NET SDK is installed.
Check for version compatibility for optimal performance. Check for version compatibility for optimal performance.
@ -43,7 +37,7 @@ in {
::: {.warning} ::: {.warning}
At the moment, only `roslyn-ls`(with roslyn-nvim) provides full Razor support. At the moment, only `roslyn-ls`(with roslyn-nvim) provides full Razor support.
`csharp-ls` is limited to `.cshtml` files. `csharp_ls` is limited to `.cshtml` files.
::: :::
''; '';
@ -118,6 +112,15 @@ in {
listImplementations = mkMappingOption "List implementations [omnisharp-extended-lsp-nvim]" mappings.listImplementations; listImplementations = mkMappingOption "List implementations [omnisharp-extended-lsp-nvim]" mappings.listImplementations;
}; };
}; };
csharpls-extended-lsp-nvim = {
enable = mkEnableOption ''
Extended 'textDocument/definition' handler for csharp_ls Neovim LSP
::: {.note}
This feature only works for `csharp_ls`.
:::
'';
};
}; };
treesitter = { treesitter = {
@ -210,5 +213,17 @@ in {
''; '';
}; };
}) })
(mkIf (cfg.lsp.enable
&& cfg.extensions.csharpls-extended-lsp-nvim.enable
&& (elem "csharp_ls" cfg.lsp.servers)) {
vim = {
startPlugins = ["csharpls-extended-lsp-nvim"];
lsp.servers.csharp_ls.on_attach = mkLuaInline ''
function(client, bufnr)
require('csharpls_extended').buf_read_cmd_bind()
end
'';
};
})
]); ]);
} }