0

I have a variable of function type.

var onLengthChanged: (Int?) -> Unit = {}

When I invoke the function, hint appears for parameter p1, although it was unnamed. I guess that this is an auto-generated name. It looks like this:

enter image description here

Is there any way to disable hints for auto-generated parameter names only?

According to this question: IntelliJ shows method parameter hints on usage - How to disable it it is possible to disable hints in Settings -> Editor -> General -> Appearance unchecking Show parameter name hints option. There is also "Configure..." button, but I wasn't able to find any appropriate option to disable hints in this specific case.

fdermishin
  • 3,519
  • 3
  • 24
  • 45
  • You can name it `var onLengthChanged: (input: Int?) -> Unit = {}`. – Joshua Oct 26 '17 at 09:52
  • There are cases where adding parameter name is a good idea. However, often it becomes unnecessarily verbose. Unfortunately there are a lot of such parameters across my project, so adding them all is not an option. In my opinion there is no sense in showing hint if developer decided not to provide name of the parameter. – fdermishin Oct 26 '17 at 10:39
  • If you really want that feature, you should open a feature request. But it would probably take a long time because type hint appears on IDLE much earlier. It takes time for Android Studio to catch up. – Joshua Oct 26 '17 at 10:49

1 Answers1

0

It turned out that this issue has been fixed already when I posted the question: https://youtrack.jetbrains.com/issue/KT-19216#tab=History

Everything works fine now.

fdermishin
  • 3,519
  • 3
  • 24
  • 45