2024-12-18 16:44:21 -05:00
|
|
|
self: {
|
2024-10-05 15:17:16 -04:00
|
|
|
config,
|
|
|
|
lib,
|
2024-11-22 02:48:41 -05:00
|
|
|
pkgs,
|
2024-10-05 15:17:16 -04:00
|
|
|
...
|
|
|
|
}: let
|
2024-12-18 16:44:21 -05:00
|
|
|
inherit (self.lib.${pkgs.system}) buildPlugin;
|
|
|
|
inherit (self.inputs) vimplugin-roslyn-nvim-src;
|
2024-11-22 02:48:41 -05:00
|
|
|
|
2024-12-22 00:04:13 -05:00
|
|
|
inherit (lib) mkIf;
|
|
|
|
|
2024-11-22 02:48:41 -05:00
|
|
|
cfg = config.programs.neovim;
|
2024-12-22 03:12:45 -05:00
|
|
|
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
|
2024-12-18 16:44:21 -05:00
|
|
|
in {
|
2024-12-21 23:34:10 -05:00
|
|
|
config = mkIf cfg.enable {
|
2024-10-05 15:17:16 -04:00
|
|
|
programs = {
|
|
|
|
neovim = {
|
2024-12-22 00:04:13 -05:00
|
|
|
plugins = [
|
|
|
|
{
|
|
|
|
plugin = buildPlugin "roslyn-nvim" vimplugin-roslyn-nvim-src;
|
|
|
|
type = "lua";
|
|
|
|
config =
|
|
|
|
# lua
|
|
|
|
''
|
|
|
|
vim.api.nvim_create_autocmd('User', {
|
|
|
|
pattern = 'RoslynInitialized',
|
2024-10-05 15:17:16 -04:00
|
|
|
|
2024-12-22 00:04:13 -05:00
|
|
|
callback = function()
|
2024-12-18 16:44:21 -05:00
|
|
|
vim.lsp.inlay_hint.enable();
|
|
|
|
end,
|
2024-12-22 00:04:13 -05:00
|
|
|
});
|
2024-10-31 23:13:02 -04:00
|
|
|
|
2024-12-22 03:12:45 -05:00
|
|
|
local startRoslyn = function()
|
|
|
|
require('roslyn').setup({
|
|
|
|
config = {
|
|
|
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
2024-12-22 00:04:13 -05:00
|
|
|
|
2024-12-22 03:12:45 -05:00
|
|
|
on_attach = function()
|
|
|
|
vim.lsp.inlay_hint.enable();
|
|
|
|
end,
|
2024-12-22 00:04:13 -05:00
|
|
|
|
2024-12-22 03:12:45 -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-12-22 00:04:13 -05:00
|
|
|
},
|
2024-12-18 16:44:21 -05:00
|
|
|
},
|
2024-10-05 15:17:16 -04:00
|
|
|
|
2024-12-22 03:12:45 -05:00
|
|
|
exe = 'Microsoft.CodeAnalysis.LanguageServer',
|
|
|
|
});
|
|
|
|
end;
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
|
|
pattern = { 'cs' },
|
|
|
|
|
|
|
|
callback = function()
|
|
|
|
vim.cmd[[setlocal ts=4 sw=4 sts=0 expandtab]];
|
|
|
|
|
|
|
|
if (devShells['csharp'] == nil) then
|
|
|
|
devShells['csharp'] = 1;
|
|
|
|
|
2024-12-22 12:42:29 -05:00
|
|
|
require('nix-develop').nix_develop({'${flakeEnv}#csharp'}, vim.schedule_wrap(function()
|
|
|
|
startRoslyn();
|
|
|
|
vim.cmd[[e]]; -- reload to attach on current file
|
|
|
|
end));
|
2024-12-22 03:12:45 -05:00
|
|
|
end
|
|
|
|
end,
|
2024-12-22 00:04:13 -05:00
|
|
|
});
|
|
|
|
'';
|
|
|
|
}
|
2024-12-18 16:44:21 -05:00
|
|
|
];
|
2024-10-05 15:17:16 -04:00
|
|
|
};
|
|
|
|
};
|
2024-12-18 16:44:21 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
# For accurate stack trace
|
2024-12-21 23:34:10 -05:00
|
|
|
_file = ./default.nix;
|
2024-12-18 16:44:21 -05:00
|
|
|
}
|