Closed cpea2506 closed 2 months ago
Inlay hints probably need to be enabled on the server side using settings. These are the settings supported by the roslyn language server, modifying those would probably work, would be good to accept it as part of plugin setup. Feel free to open a PR, otherwise I'll try to do it when I have some time.
Inlay hints probably need to be enabled on the server side using settings. These are the settings supported by the roslyn language server, modifying those would probably work, would be good to accept it as part of plugin setup. Feel free to open a PR, otherwise I'll try to do it when I have some time.
I'm trying to set this up at the moment, but I'm unsure what I should be passing to the settings object.
Should I be passing an object that matches the state of the settings in the package.json
?
e.g. csharp.inlayHints.enableInlayHintsForTypes=true
Or should I be using the internal roslyn setting that is passed to the server?
e.g. RoslynExtensionsOptions:InlayHintsOptions:EnableForTypes=true
After digging into the LSP code, the actual option types for inlay hints should be as follows:
"inlay_hints.dotnet_enable_inlay_hints_for_parameters",
"inlay_hints.dotnet_enable_inlay_hints_for_literal_parameters",
"inlay_hints.dotnet_enable_inlay_hints_for_indexer_parameters",
"inlay_hints.dotnet_enable_inlay_hints_for_object_creation_parameters",
"inlay_hints.dotnet_enable_inlay_hints_for_other_parameters",
"inlay_hints.dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix",
"inlay_hints.dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent",
"inlay_hints.dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name",
"inlay_hints.csharp_enable_inlay_hints_for_types",
"inlay_hints.csharp_enable_inlay_hints_for_implicit_variable_types",
"inlay_hints.csharp_enable_inlay_hints_for_lambda_parameter_types",
"inlay_hints.csharp_enable_inlay_hints_for_implicit_object_creation",
However, doing the following still gives no inlay hints:
require("roslyn").setup({
settings = {
inlay_hints = {
dotnet_enable_inlay_hints_for_parameters = true,
csharp_enable_inlay_hints_for_types = true,
}
},
})
@SchnozzleCat
I just found the correct setup, for list of settings and default values, take a look at this https://github.com/jmederosalvarado/roslyn.nvim/pull/17#issuecomment-1864205742
I will mark this issue as completed, thanks for you all responses.
require("roslyn").setup({
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,
},
},
})
I try to enable
inlay_hint
viaon_attach
callback and it doesn't seem to work. I'm not sure it is enable by default or must be toggle via settings.I also try to get the result of of the function below but it returns
{}