This plugin adds a clickable inlay hint for the implicit invoke
call made when a Kotlin instance with an operator fun invoke()
method is called as a function.
Clicking the hint will navigate to the invoke
method.
This is useful because there is no current way to do this directly in the IDE.
E.g.
class Reverser {
operator fun invoke(str: String) = str.reverse()
}
val reverser = Reverser()
println(reverser(“!dlrow olleH”))
Navigating to the declaration of reverser
on the last line will take you to the declaration of the val reverser
.
Navigating to the type of reverser
will take you to the class Reverser
, but you will still have to locate the invoke method yourself, which is not always straightforward.
The inlay added by this plugin gives you a direct link to the invoke method, which is handy when browsing and debugging code that uses objects as functions.
-
Using the IDE built-in plugin system:
Settings/Preferences > Plugins > Marketplace > Search for "uncloak-invoke" > Install
-
Using JetBrains Marketplace:
Go to JetBrains Marketplace and install it by clicking the Install to ... button in case your IDE is running.
You can also download the latest release from JetBrains Marketplace and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...
-
Manually:
Download the latest release and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...
Plugin based on the IntelliJ Platform Plugin Template.