I have code like this everywhere
val someName = 10
var someOtherName = "hello"
def add(a, b) = a + b
I prefer to have the types coded in (rather than the compiler figuring it out) in most of the code. It would be great if IntelliJ had some auto-format option to just add the types, so that the above becomes:
val someName: Int = 10
var someOtherName: String = "hello"
def add(a: Int, b: Int): Int = a + b
Does a tool exist?
Quoting the comment from Yadu Krishnan:
Do you want to add it in all the existing code ? If it is required only in some cases, you can manually do it by using the key combination "alt + enter" after the method/variable name. Then it will ask suggestion to add the method/variable type.
It should be Yadu Krishnan to write this answer, if he does, please accept his response. I'm only making this one to become clearer that there is a solution, that worked in my case at least
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With