-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Show parameter hints for None
parameters
#3273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Wait, we already have parameter hints, but they don't seem to work on |
Ah. I guess it would be annoying if they were always shown? What does IntelliJ do? Displaying the hint for |
Um, so it always displays the parameter hints? |
Right, that should be formulated as
|
For the context, here's the way to simplify the code proposed before: #1606 (comment) I've applied the suggestion, but |
It does seem a bit busy when combined with field matching, but I could get used to it. Does it also work for function parameters? |
Not yet. |
I think so. We should definitely have name hints since that's more important for reading code. If you need type info you can get it through hover or signature help. |
What about something like "if type is Foo and argument name is foo, don't show name inlay hint" and "if expr is something like foo or bar.foo and argument name is foo, don't show name inlay hint"? That omits the name inlay hint in the cases where the arg name is most obvious. |
Oh, yeah, I was totally talking about name hints for function parameters. |
I've added a few heuristics here: #3279 |
Agree. Consider the following example: Here we see that inlay hint does not provide any new information... except for a ton of visual noise. Just by looking at match arms I already can infer types, more or less. So I'd rather say that Also it could get very noisy in case of several hints per line of code: Maybe we should have some heuristics and limit not only the length of a hint, but the total length of all hints per line. And then either opt out hints completely, or reduce their complexity by displaying less nested types. |
3287: Omit type hints for enum variant bind pats r=matklad a=SomeoneToIgnore After using new hints for a while, I've started to think that hints for enum variants are an overkill. Another user also shares the same toughts: #3273 (comment) Co-authored-by: Kirill Bulatov <[email protected]>
Yes, I agree with you after using the new hints for a while, the PR fixing this is being merged to master right now. For the other part of your proposal, seems valid, we need to investigate the possible solutions some time later. |
Automatic Rustup
Automatic Rustup
Would be cool to know which
None
means what. Guess we need to just refactor the API, but having a hit would be a useful bandaid.I think we literarly should just check for
None
, rather than use a more general rule, like "is this a const item". Though not sure here.cc @SomeoneToIgnore
The text was updated successfully, but these errors were encountered: