Is there any way to automatically insert the infer...
# intellij
a
Is there any way to automatically insert the inferred type of a function through an ide command/keyboard shortcut? Eg if
Copy code
fun a(): Int
Exists and I write
Copy code
fun b() = a() + 2
I’d like to be able to automatically create
Copy code
fun b(): Int = a() + 2
Currently I can view the inferred type but I still need to copy it myself, which isn’t easy with the pop up dialog
s
Sure, just bring up the intentions dropdown w/
alt/option+enter
and you’ll see the option you’re looking for
3
k
I always wonder what "show function return types" is doing in that menu. It's not an action like most other things, it should really just be a setting.
a
Wow! Can’t believe I didn’t see that before. This is great 🙂
Is the signature display on the right a setting?
s
@Allan Wang it is not - that’s just the Worksheet-style in-line output in a scratch file