nixos-configs/homeManagerModules/neovim/langs/csharp.nix

78 lines
2.6 KiB
Nix
Raw Normal View History

2024-12-18 16:44:21 -05:00
self: {
2024-10-05 15:17:16 -04:00
config,
lib,
pkgs,
2024-10-05 15:17:16 -04:00
...
}: let
2024-12-16 17:44:17 -05:00
inherit (lib) attrValues mkIf;
2024-12-18 16:44:21 -05:00
inherit (self.lib.${pkgs.system}) buildPlugin;
inherit (self.inputs) vimplugin-roslyn-nvim-src;
cfg = config.programs.neovim;
2024-12-18 16:44:21 -05:00
in {
config = mkIf cfg.enableIde {
2024-10-05 15:17:16 -04:00
programs = {
neovim = {
2024-12-16 17:44:17 -05:00
extraPackages = attrValues {
2024-10-05 15:17:16 -04:00
inherit
(pkgs)
2024-12-18 16:44:21 -05:00
roslyn-ls
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',
});
2024-12-18 16:44:21 -05:00
vim.api.nvim_create_autocmd('User', {
pattern = 'RoslynInitialized',
callback = function()
vim.lsp.inlay_hint.enable();
end,
});
2024-12-18 16:44:21 -05:00
require('roslyn').setup({
config = {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
2024-10-05 15:17:16 -04:00
2024-12-18 16:44:21 -05:00
on_attach = function()
vim.lsp.inlay_hint.enable();
end,
2024-12-18 16:44:21 -05:00
settings = {
["csharp|inlay_hints"] = {
csharp_enable_inlay_hints_for_implicit_object_creation = true,
csharp_enable_inlay_hints_for_implicit_variable_types = true,
csharp_enable_inlay_hints_for_lambda_parameter_types = true,
csharp_enable_inlay_hints_for_types = true,
dotnet_enable_inlay_hints_for_indexer_parameters = true,
dotnet_enable_inlay_hints_for_literal_parameters = true,
dotnet_enable_inlay_hints_for_object_creation_parameters = true,
dotnet_enable_inlay_hints_for_other_parameters = true,
dotnet_enable_inlay_hints_for_parameters = true,
dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix = true,
dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name = true,
dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent = true,
},
},
2024-10-05 15:17:16 -04:00
},
2024-12-18 16:44:21 -05:00
exe = 'Microsoft.CodeAnalysis.LanguageServer',
2024-10-05 15:17:16 -04:00
});
'';
2024-12-18 16:44:21 -05:00
plugins = [
(buildPlugin "roslyn-nvim" vimplugin-roslyn-nvim-src)
];
2024-10-05 15:17:16 -04:00
};
};
2024-12-18 16:44:21 -05:00
};
# For accurate stack trace
_file = ./csharp.nix;
}