languages/csharp: Replace root_markers with root_dir

Replace the root_markers with root_dir in roslyn_ls and omnisharp
This commit is contained in:
Cool-Game-Dev 2025-08-13 09:03:09 -05:00
commit 9eb060dde2
No known key found for this signature in database

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 = {
@ -138,7 +149,18 @@
''; '';
filetypes = ["cs"]; 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 = {}; init_options = {};
}; };
}; };