Android Studio 3.0 parameter hints information not always visible?
Asked Answered
A

6

24

Sorry, I don't know how this new functionality is called exactly, please look at screenshot: enter image description here

So, parameter name is visible in method call. This is cool, but as you can see, only first parameter in this case, second has no name visible. From my observations, it sometimes works, sometimes it doesn't and I am unable to figure out why.

Can I configure it, or it's just a bug? Or maybe I'm not understand how that functionality is intended to work.

Aport answered 6/11, 2017 at 11:51 Comment(2)
when you send static input to method then shows parameter name .Font
by default, android studio doesn't show if method name contains parameter name and for builders.Isiahisiahi
L
13

You can enable it by doing the following:

  1. Go to File > Settings > Editor > General > Appearance > Show parameter name hints
  2. Click Configure
  3. Language: -> Java
  4. Options -> Check Show hints even when type of expression is clear

As you can see below, it is visible for all parameters regardless of type:

parameter hind is visible for all parameters regardless of type

EDIT

It looks like this setting was removed in Android Studio 4.0

There are however new Inlay Hints options:

  1. Go to File > Settings > Editor > Inlay Hints > Java > Parameter hints
  2. Check Show parameter hints for:

enter image description here

Logotype answered 6/1, 2020 at 8:24 Comment(0)
I
20

1.

Press Alt-Enter on your method and select doesn't show hints for the current method. Then you can see a dialog in the bottom right of the android studio. select Show Parameters Hint Setting, now you can customize this functionality. and finally, select undo in the dialog.

2.

File -> Setting -> Editor -> General -> Appearaance-> show parameters hint configure

Isiahisiahi answered 6/11, 2017 at 11:58 Comment(0)
L
13

You can enable it by doing the following:

  1. Go to File > Settings > Editor > General > Appearance > Show parameter name hints
  2. Click Configure
  3. Language: -> Java
  4. Options -> Check Show hints even when type of expression is clear

As you can see below, it is visible for all parameters regardless of type:

parameter hind is visible for all parameters regardless of type

EDIT

It looks like this setting was removed in Android Studio 4.0

There are however new Inlay Hints options:

  1. Go to File > Settings > Editor > Inlay Hints > Java > Parameter hints
  2. Check Show parameter hints for:

enter image description here

Logotype answered 6/1, 2020 at 8:24 Comment(0)
C
6

In Android Studio 4.1.3

File - settings - Editor - inlay hints - Kotlin (or java) - choose "types" then mark (or unmark) the box that says "show hints for" then mark (or unmark) your choices

How its made in Android Studio 4.1.3

Caco answered 4/5, 2021 at 19:22 Comment(0)
E
3

In 2020

For Webstorm & PhpStorm

If variable calling not shows the parameter hints, you can enable it by going to

File => Setting => Editor => Inlay Hints => (preferred language) => parameter hints => For non-literal arguments

Euphrosyne answered 14/4, 2020 at 20:30 Comment(3)
This setting under Java. Also, disappointingly, it appears there's no way to configure parameter hints to always appear.Emanate
The Question was about Android Studio. I don't understand why someone should be interested in solutions for other IDEs that are not even meant for Android development...Styles
This answer exists here because if someone searching for JetBrains specific problem, he/she can found the answer from this postEuphrosyne
A
1

Android Studio Flamingo or Higher

File -> Settings -> Editor -> Inlay Hints -> [Explore Options]

Absentminded answered 27/4, 2023 at 6:10 Comment(0)
T
0

Only the primitive and some complex types show hints. You can disable it by right clicking on hint and then "Disable Hints".

For example:

public void myFunction(int a, boolean b, MyClass myClass)
    //do something
}

If you call:

myFunction(10, true, new MyClass()); 

Only the first two will show hints...

Tedder answered 6/11, 2017 at 11:58 Comment(5)
I don't want to disable, I want to get hints for all parameters. I know I can disable or configure in Settings->Appearance. But still it's not always showingAport
Actually, the hints will show only for primitive types, like int or boolean. If the parameter is a class you created for example, the hints will not show.Tedder
yes it seems you are right. I still don't undestand reason why my question is down voted though :/ It;s not obvious only primitives are supportedAport
EDIT: nope, some complex types are supported as well, for example Context: i.imgur.com/Jzj3aCL.pngAport
The hints show for literals, not primitives. Variables with primitive types as arguments do not trigger hints, presumably because variable names ought to be self-documenting. Literal strings, booleans, numerics, null and this all trigger hints.Quinquevalent

© 2022 - 2024 — McMap. All rights reserved.