Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible in Intellij IDEA Scala plugin to know which implicit conversion was applied?

When an implicit conversion is applied, IntelliJ underlines the converted code. Is it possible to navigate to the applied conversion in some way?

like image 415
Diego Avatar asked Aug 20 '12 14:08

Diego


People also ask

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.

What is Scala plugin in IntelliJ?

The Scala plugin extends IntelliJ IDEA's toolset with support for Scala, SBT, Scala. js, Hocon, and Play Framework. Support for Scala, SBT and Hocon is available for free in IntelliJ IDEA Community Edition, while support for Play Framework and Scala. js is available only in IntelliJ IDEA Ultimate.

How do I find the Scala version in IntelliJ?

BTW, if you want to find out in IntelliJ, simply click on some class part of the Scala library, it takes you to the definition. Look at the bread crumb below the menu bar. It shows you which file it found it, the file name includes the version number.


2 Answers

Yes it is possible (IntelliJ IDEA 11.1.3 CE with Scala Plug-In 0.5.948, but this has been possible for a while).

You need to select the receiver not the method itself. For instance, assume dataDir is of type java.io.File. Then I can do

dataDir.listFiles().foreach( ... ) 

where foreach is available through implicit conversion from Array to ArrayOps, thus is underlined. If you select dataDir.listFiles() and choose from the menu Navigate -> Implicit Conversion (shortcut Ctrl-Q), a popup menu shows you all possible conversions, and selects the conversion currently applied.

enter image description here

like image 191
0__ Avatar answered Sep 22 '22 12:09

0__


As above but the shortcut in Windows/Linux is Ctrl+Shift+Q.

like image 33
Maciej Falski Avatar answered Sep 21 '22 12:09

Maciej Falski