Working with Scala Show Type Info Action
IntelliJ IDEA offers an easy way to work with type inference feature such as Scala Show Type Info action.
- Entering code
- Invoking Show Type Info Action
- Adding Type Annotation
- Removing Type Annotation
- Seeing Type Annotation on Expression
Entering code
Invoking Show Type Info Action
- If you select Show type info on mouse hover after, ms check box in , then in the Editor, you can simply navigate with the mouse to a value to see its type information.
- To invoke Show Type Info action in Editor, navigate to the value and press Alt + =
(Ctrl + Shift + P for OS X): - You can also see the type information on a value definition. Simply put the caret on a value definition and press Alt + =
(Ctrl + Shift + P for OS X):
Adding Type Annotation
- To add a type annotation, highlight the value and press Alt + Enter: As a result, the type annotation is added:
- You can also use Adjust types action to shorten types with full qualified names. In this case the necessary imports are added.
Removing Type Annotation
Seeing Type Annotation on Expression
- To see the type information on an expression, simply navigate to the expression, highlight it and press Alt + =
(Ctrl + Shift + P for OS X):
Last modified: 23 November 2016