nixos-configs/common/home/neovim/langs/csharp.nix

67 lines
2 KiB
Nix
Raw Normal View History

2024-10-05 15:17:16 -04:00
{
config,
pkgs,
lib,
...
}: let
inherit (lib) mkIf;
inherit (config.vars) neovimIde;
in
mkIf neovimIde {
programs = {
neovim = {
extraPackages = builtins.attrValues {
inherit
(pkgs)
omnisharp-roslyn
2024-10-05 15:17:16 -04:00
;
};
extraLuaConfig =
# lua
''
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'cs' },
2024-10-05 15:17:16 -04:00
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
});
local omnisharp_extended = require('omnisharp_extended');
require('lspconfig').omnisharp.setup({
cmd = { "dotnet", "${pkgs.omnisharp-roslyn}/lib/omnisharp-roslyn/OmniSharp.dll" },
2024-10-05 15:17:16 -04:00
handlers = {
["textDocument/definition"] = omnisharp_extended.definition_handler,
["textDocument/typeDefinition"] = omnisharp_extended.type_definition_handler,
["textDocument/references"] = omnisharp_extended.references_handler,
["textDocument/implementation"] = omnisharp_extended.implementation_handler,
},
settings = {
FormattingOptions = {
EnableEditorConfigSupport = true,
OrganizeImports = true,
},
MsBuild = {
LoadProjectsOnDemand = false,
},
RoslynExtensionsOptions = {
EnableAnalyzersSupport = true,
EnableDecompilationSupport = true,
EnableImportCompletion = true,
AnalyzeOpenDocumentsOnly = false,
},
Sdk = {
IncludePrereleases = true,
},
2024-10-05 15:17:16 -04:00
},
});
'';
plugins = builtins.attrValues {
inherit (pkgs.vimPlugins) omnisharp-extended-lsp-nvim;
2024-10-05 15:17:16 -04:00
};
};
};
}