lsp_extensions.nvim icon indicating copy to clipboard operation
lsp_extensions.nvim copied to clipboard

Don't display parameter name hints

Open mvforell opened this issue 3 years ago • 8 comments

I don't think it makes much sense to display parameter name hints at the end of the line because

  1. they interfere with type hints (I find it confusing to have type and parameter name hints mixed together),
  2. they're far away from the parameter value and
  3. 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.

mvforell avatar Oct 12 '20 22:10 mvforell

Is it better choice that control on or off by a variable?

glepnir avatar Oct 13 '20 05:10 glepnir

I'm not sure, other options like only_current_line are passed as a parameter as well.

mvforell avatar Oct 13 '20 13:10 mvforell

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?

tjdevries avatar Oct 19 '20 18:10 tjdevries

Sounds great!

mvforell avatar Oct 23 '20 17:10 mvforell

@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 ChainingHints. The screenshot shows the other types in action. image

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.

PatOConnor43 avatar Oct 25 '20 21:10 PatOConnor43

I also created this issue to track adding that better support. FYI @mvforell https://github.com/nvim-lua/lsp_extensions.nvim/issues/14

PatOConnor43 avatar Oct 25 '20 22:10 PatOConnor43

Actually, it looks like we can't draw virtual text interspersed in a line. It only appears at the end of a line. :grimacing:

PatOConnor43 avatar Oct 25 '20 22:10 PatOConnor43

Is this resolved by #19?

ebobrow avatar Jun 30 '21 00:06 ebobrow