Show inferred type in Intellij Scala plugin

You can:

  • Make sure the text cursor is within the variable and check the menu View > Type Info for its shortcut. Use that shortcut to display type info. On OS X, it's ctrl-shift-P.
  • Or set preferences to show the same type info on mouse hover in Preferences > IDE Settings > Scala. Check "Show type info on mouse motion with delay" and change the delay if you want.

enter image description here

Alternatively, instead of just showing type info, you can show the documentation for the type. It will show the type even if there is no scaladoc or javadoc applicable.

  • Use the Quick Documentation shortcut (seen in View > Quick Documentation) like the type info one. On OS X, it's ctrl-J.
  • Or set preferences to show quick doc on mouse hover in Preferences > IDE Settings > Editor. Check "Show quick doc on mouse move" and change the delay if you want.

enter image description here


In addition to @Cyäegha approach you can even tell idea to infer the type and add it for you.

On OS X, go on the variable, click alt + enter and you should see this

enter image description here

After you click on it you'll see

val test: String = "dsds"

The short key is at the voice Show Intention Actions.