23

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.

SiHa
  • 7,830
  • 13
  • 34
  • 43
user1209216
  • 7,404
  • 12
  • 60
  • 123

6 Answers6

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

FarshidABZ
  • 3,860
  • 4
  • 32
  • 63
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

Pierre
  • 8,397
  • 4
  • 64
  • 80
4

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

MarkT
  • 378
  • 2
  • 7
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

Community
  • 1
  • 1
Nisharg Shah
  • 16,638
  • 10
  • 62
  • 73
  • This setting under Java. Also, disappointingly, it appears there's no way to configure parameter hints to always appear. – rmirabelle Feb 05 '21 at 11:57
  • 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... – The incredible Jan Feb 10 '21 at 14:20
  • This answer exists here because if someone searching for JetBrains specific problem, he/she can found the answer from this post – Nisharg Shah Feb 10 '21 at 18:44
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...

gbruscatto
  • 686
  • 7
  • 21
  • 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 showing – user1209216 Nov 06 '17 at 12:00
  • 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. – gbruscatto Nov 06 '17 at 12:03
  • 1
    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 supported – user1209216 Nov 06 '17 at 12:05
  • EDIT: nope, some complex types are supported as well, for example `Context`: https://i.imgur.com/Jzj3aCL.png – user1209216 Nov 06 '17 at 12:07
  • 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. – Clement Cherlin Dec 03 '17 at 02:15
0

Android Studio Flamingo or Higher

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

starball
  • 20,030
  • 7
  • 43
  • 238