Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA scala type info

The Eclipse scala plugin has a very nice info. One can hover over pretty much anything be it a function definition, val, var, function call etc and get type info. This is immensely useful to me to ensure type compatibility especially when I am trying new things out.

Is there a similar feature in IntelliJ Idea 12.1 (the latest version as of this comment)?

The closest thing I could find was the type info setting. The default key binding did not even work for me on Mac OS 10.7.5. Even after tweaking, it does not work as universally as it does in Eclipse which shows a type for pretty much everything. Has any one managed to get this to work? My ideal setting would be type info on hover just like in the Eclipse.

I have heard great things about the IntelliJ IDE for Scala but so far the Eclipse Scala plugin wins hands down.

like image 673
Rajiv Avatar asked Apr 04 '13 21:04

Rajiv


People also ask

How do I show type in IntelliJ?

Type Info In IntelliJ IDEA, you can identify the type of an expression in the following way: Place the caret at the necessary code element and press Ctrl+Shift+P (or select View | Type Info from the main menu).

How do I check my Scala version?

Type scala -version in your terminal. If the output shows that Scala 2.11. 1 (or higher) is installed, then you are done.

How do I get Scala class in IntelliJ?

On the Project pane on the left, right-click src and select New => Scala class. If you don't see Scala class, right-click on HelloWorld and click on Add Framework Support…, select Scala and proceed. If you see Error: library is not specified, you can either click download button, or select the library path manually.

Does IntelliJ work with Scala?

To start working with Scala in IntelliJ IDEA you need to download and enable the Scala plugin. If you run IntelliJ IDEA for the first time, you can install the Scala plugin when IntelliJ IDEA suggests downloading featured plugins. Otherwise, you can use the Settings | Plugins page for the installation.


2 Answers

To enable on mouse hover type information go to Settings->Scala and select the "Show type info on mouse motion with delay" checkbox.

enter image description here

like image 169
yǝsʞǝla Avatar answered Oct 03 '22 00:10

yǝsʞǝla


Type Info is great in IntelliJ; you have to press the key shortcut to see the type of a given variable or function.

If I recall correctly, there's a conflict between Type Info's key shortcut and something else in IntelliJ. If you go to Settings -> Keymap -> Plug-ins -> Scala -> Type Info, double-click it, you'll see the conflicts. I changed mine to Option =. (see this answer for more tips if it still doesn't work)

Another shortcut I use quite a lot to quickly look up a definition is shift I.

like image 27
Alex Yarmula Avatar answered Oct 03 '22 00:10

Alex Yarmula