Skip to content
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

More intelligent hints #1524

Closed
alygin opened this Issue Jul 28, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@alygin
Copy link
Contributor

alygin commented Jul 28, 2017

Having inlay parameter hints is cool, but sometimes it can bee quite annoying. In mature languages, this feature uses additional rules to hide hints when they are redundant. I don't know all the rules, but here're a few that are obvious:

  1. Local variable that is passed as an argument, has the same name as the parameter:

screen shot 2017-07-28 at 09 47 11

  1. There's a single parameter (not counting self in methods) and its name matches the function's name:

screen shot 2017-07-28 at 09 52 20

  1. Functions that start with set_ and have single parameter (not counting self in methods):

screen shot 2017-07-28 at 09 55 25

In all these cases hints could be safely omitted.

@farodin91

This comment has been minimized.

Copy link
Contributor

farodin91 commented Jul 28, 2017

I like the idea of intelligent hints, but I would prefer to be able to switch between all and intelligent hints.

farodin91 added a commit to farodin91/intellij-rust that referenced this issue Jul 29, 2017

@alygin

This comment has been minimized.

Copy link
Contributor Author

alygin commented Jul 29, 2017

Here's the exact rules that Java uses (they can be found in "Show parameter name hints -> Configure... -> Java") setting:

  • White list of name patterns (a couple dozens by default, customizable)
  • Do not show if method name contains parameter name
  • Show for non-literals in case of multiple params with the same type (off by default)
  • Do not show for builder-like methods

bors bot added a commit that referenced this issue Jul 31, 2017

Merge #1536
1536: TYPE: Extend hints r=alygin

Fixes: #1524 & #1522

farodin91 added a commit to farodin91/intellij-rust that referenced this issue Aug 1, 2017

farodin91 added a commit to farodin91/intellij-rust that referenced this issue Aug 2, 2017

bors bot added a commit that referenced this issue Aug 3, 2017

Merge #1536
1536: TYPE: Extend hints r=matklad

Fixes: #1524 & #1522

bors bot added a commit that referenced this issue Aug 3, 2017

Merge #1536
1536: TYPE: Extend hints r=matklad

Fixes: #1524 & #1522

@bors bors bot closed this in #1536 Aug 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.