How do I view the type of a scala expression in IntelliJ

Solution 1:

Select expression and type Alt + =.


If you want to change the shortcut go to Preferences > Keymap and enter "Type Info" in the search field.

In older versions, it's Shift + Ctrl + Alt + T.

Solution 2:

On OS X, it's ctrl + shift + P for me. This shows the exact type with resolved generics.

Solution 3:

CTRL / Command key and hover over the variable or method.

Solution 4:

You can hit Ctrl + Q on a variable or method signature to view its type.

There is also a neat trick to view type of any expression: select the expression and type Ctrl + Alt + V. This will show Extract variable dialog with expression type to be extracted shown for convenience.