feat(roslyn): force inject capabilities for blink.cmp

This commit is contained in:
Radu C. Martin 2025-02-21 11:52:03 +01:00
parent 8f997a4dca
commit a4e40d86af

View file

@ -1,28 +1,55 @@
return {
'seblj/roslyn.nvim',
event = { 'BufReadPre', 'BufNewFile' },
ft = 'cs',
opts = {
filewatching = false,
broad_search = true,
-- ignore_sln = function(sln)
-- return string.match(sln, 'Contactify.sln') ~= nil
-- end,
config = {
settings = {
['csharp|inlay_hints'] = {
csharp_enable_inlay_hints_for_implicit_variable_types = true,
csharp_enable_inlay_hints_for_types = true,
csharp_enable_inlay_hints_for_parameters = true,
{
'seblj/roslyn.nvim',
config = function()
-- NOTE: not sure if needed. check https://github.com/seblyng/roslyn.nvim/issues/90
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('blink.cmp').get_lsp_capabilities(capabilities)
capabilities = vim.tbl_deep_extend('force', capabilities, {
textDocument = {
diagnostic = {
dynamicRegistration = true,
},
},
['csharp|background_analysis'] = {
background_analysis_dotnet_analyzer_diagnostics_scope = 'openFiles',
background_analysis_dotnet_compiler_diagnostics_scope = 'openFiles',
})
require('roslyn').setup {
filewatching = true,
config = {
capabilities = capabilities,
settings = {
['csharp|background_analysis'] = {
-- background_analysis = {
-- dotnet_analyzer_diagnostics_scope = "openFiles",
-- dotnet_compiler_diagnostics_scope = "fullSolution",
-- },
dotnet_analyzer_diagnostics_scope = 'openFiles',
dotnet_compiler_diagnostics_scope = 'fullSolution',
},
['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,
},
['csharp|code_lens'] = {
dotnet_enable_references_code_lens = true,
dotnet_enable_tests_code_lens = true,
},
['csharp_completion'] = {
dotnet_show_completion_items_from_unimported_namespaces = true,
dotnet_show_name_completion_suggestions = true,
},
},
},
['csharp|completion'] = {
dotnet_show_completion_items_from_unimported_namespaces = true,
},
},
},
}
end,
},
}