lsp_extensions.nvim
lsp_extensions.nvim copied to clipboard
Don't display parameter name hints
I don't think it makes much sense to display parameter name hints at the end of the line because
- they interfere with type hints (I find it confusing to have type and parameter name hints mixed together),
- they're far away from the parameter value and
- most of the time they're not that helpful as only the name of the first parameter of the line is displayed.
If you don't agree with my point of view I'd love an extra parameter for inlay_hints
to disable parameter name hints. I fear I'm not versed enough in Lua and nvim scripting to implement this myself.
Is it better choice that control on or off by a variable?
I'm not sure, other options like only_current_line
are passed as a parameter as well.
Let's make an ignored kinds option, which is a table with the keys being kinds that you don't want displayed.
It can default to the parameter name hint like you have.
This way, people can easily filter out any kinds they don't find helpful.
Does that make sense?
Sounds great!
@tjdevries @glepnir Given the current implementation of only showing highlights at the end of the line, I think it makes sense that we only show ChainingHint
s. The screenshot shows the other types in action.
This image was taken from VSCode with the rust-analyzer plugin. The gray text is all virtual text. In this case, usize
should be a TypeHint
that annotates the inferred type of the variable. default:
is a ParameterHint
that annotates the variable name in the function. And Iter<SyntaxReference>
is a ChainingHint
.
Given that these all have different positions and meanings I don't think it makes sense to allow for all of them to appear at the end of the line. I can put up a PR real quick that only allows ChainingHint
for now and then I can re-work this extension to put the hints in their proper places sometime this week. If you disagree feel free to close the PR and we can continue the discussion here.
I also created this issue to track adding that better support. FYI @mvforell https://github.com/nvim-lua/lsp_extensions.nvim/issues/14
Actually, it looks like we can't draw virtual text interspersed in a line. It only appears at the end of a line. :grimacing:
Is this resolved by #19?