Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Don't display parameter name hints #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mvforell
Copy link

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.

@glepnir
Copy link
Contributor

glepnir commented Oct 13, 2020

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

@mvforell
Copy link
Author

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

@tjdevries
Copy link
Member

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?

@mvforell
Copy link
Author

Sounds great!

@PatOConnor43
Copy link
Contributor

@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
Copy link
Contributor

I also created this issue to track adding that better support. FYI @mvforell
#14

@PatOConnor43
Copy link
Contributor

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

@ebobrow
Copy link

ebobrow commented Jun 30, 2021

Is this resolved by #19?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants