Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ/Kotlin: What does the `^use` hint mean?

I'm using Kotlin in IntelliJ. I've written a fairly typical recursive function with a couple streams to zip up some files. I'm seeing a ^use and I don't know what IntelliJ is trying to tell me. (Hovering over such things usually teaches me something I didn't know about the language or warns me about a common mistake, but this provides no details)

Here is the screenshot of my function with an arrow pointing to the the hint.

The hint <code>^use</code> in front of a call to the file input stream copyTo extension function

like image 629
Paul Nelson Baker Avatar asked Feb 08 '19 19:02

Paul Nelson Baker


People also ask

How do I enable hint in IntelliJ?

Open the Settings/Preferences dialog ( Ctrl+Alt+S ) and go to Editor | Inlay Hints | <required language>. Select Parameter hints from the list, make sure the Show parameter hints checkbox is selected, and then specify the context where you want parameter hints shown.

How do I turn off hints in IntelliJ?

To disable hints completely, uncheck Settings → Editor → General → Appearance → Show parameter name hints.

What is jump to function in IntelliJ?

In IntelliJ IDEA, you can see where and how symbols, such as tags, classes, fields, methods, or functions are defined in your project. For this purpose, the IDE features the Quick Definition popup. To view definition of a symbol, select it in the editor and press Ctrl+Shift+I (or click View | Quick Definition).


1 Answers

This hint marks an expression that is a return value of a lambda, also saying which function the lambda is passed to. It reads as 'returned from the lambda passed to use { ... }'.

As the last expression in each lambda is the return value, this hint helps finding which lambda the expression is actually returned from.

You can disable these hints in the IDE preferences: EditorGeneralAppearanceShow parameter hints – ConfigureLanguage: KotlinShow lambda return expression hints (also available from the hint's right click menu), the other kinds of inline hints are also set up there.

UPD: In IntelliJ IDEA 2019.3 and newer, these options are placed under EditorInlay HintsKotlin.

like image 114
hotkey Avatar answered Oct 13 '22 11:10

hotkey