parent
b8d9e9ff92
commit
157a74df47
10 changed files with 159 additions and 69 deletions
homeManagerModules/neovim/langs/csharp
|
@ -10,19 +10,11 @@ self: {
|
|||
inherit (lib) mkIf;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
programs = {
|
||||
neovim = {
|
||||
extraLuaConfig =
|
||||
# lua
|
||||
''
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = { 'cs' },
|
||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||
});
|
||||
'';
|
||||
|
||||
plugins = [
|
||||
{
|
||||
plugin = buildPlugin "roslyn-nvim" vimplugin-roslyn-nvim-src;
|
||||
|
@ -38,33 +30,53 @@ in {
|
|||
end,
|
||||
});
|
||||
|
||||
require('roslyn').setup({
|
||||
config = {
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
local startRoslyn = function()
|
||||
require('roslyn').setup({
|
||||
config = {
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
|
||||
on_attach = function()
|
||||
vim.lsp.inlay_hint.enable();
|
||||
end,
|
||||
on_attach = function()
|
||||
vim.lsp.inlay_hint.enable();
|
||||
end,
|
||||
|
||||
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,
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
exe = 'Microsoft.CodeAnalysis.LanguageServer',
|
||||
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;
|
||||
|
||||
require('nix-develop').nix_develop({'${flakeEnv}#csharp'});
|
||||
startRoslyn();
|
||||
|
||||
os.execute('sleep 1')
|
||||
vim.cmd[[e]]; -- reload to attach on current file
|
||||
end
|
||||
end,
|
||||
});
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue