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
Shawn
06/18/2019, 1:13 AM
Sure, just bring up the intentions dropdown w/
alt/option+enter
and you’ll see the option you’re looking for
➕ 3
k
karelpeeters
06/18/2019, 5:34 AM
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
Allan Wang
06/18/2019, 6:17 AM
Wow! Can’t believe I didn’t see that before. This is great 🙂
Allan Wang
06/18/2019, 6:17 AM
Is the signature display on the right a setting?
s
Shawn
06/19/2019, 11:37 AM
@Allan Wang it is not - that’s just the Worksheet-style in-line output in a scratch file