Merge pull request #1074 from poseidon-rises/csharp/roslyn-ls

languages/csharp: Add roslyn-ls
This commit is contained in:
Ching Pei Yang 2025-08-13 16:34:18 +02:00 committed by GitHub
commit ebb1e3c4cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 42 additions and 1 deletions

View file

@ -477,5 +477,8 @@
[Cool-Game-Dev](https://github.com/Cool-Game-Dev): [Cool-Game-Dev](https://github.com/Cool-Game-Dev):
[just-lsp]: https://github.com/terror/just-lsp [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 just support under `vim.languages.just` using [just-lsp].
- Add [roslyn-ls] to the `vim.languages.csharp` module.

View file

@ -43,7 +43,18 @@
} }
''; '';
filetypes = ["cs" "vb"]; 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 = {}; init_options = {};
capabilities = { capabilities = {
workspace = { workspace = {
@ -126,11 +137,38 @@
AutomaticWorkspaceInit = true; 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_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 = {};
};
}; };
extraServerPlugins = { extraServerPlugins = {
omnisharp = ["omnisharp-extended-lsp-nvim"]; omnisharp = ["omnisharp-extended-lsp-nvim"];
csharp_ls = ["csharpls-extended-lsp-nvim"]; csharp_ls = ["csharpls-extended-lsp-nvim"];
roslyn_ls = [];
}; };
cfg = config.vim.languages.csharp; cfg = config.vim.languages.csharp;