Implicit and IDE Support

147 views
Skip to first unread message

Peter Wolf

unread,
Mar 28, 2017, 2:05:01 PM3/28/17
to scala-user
Starting a new thread.

Was just thinking...  Implicit would be a lot less scary for me if the IDE helped.

The scary thing about Implicits is that you don't know when they are doing something to your code.  For example, when my team replaced all the JavaConversions with JavaConverters, we discovered all sorts of unintended conversions sprinkled throughout our code.  Your code can behave very differently from the way it reads.

If the IDEA highlighted Implicit usage, perhaps in a different color or something, you would know it was there.  Hovering with the mouse could bring up a explanation of what Implicit was active, and what it was doing.

Implicit is a cool idea.  Perhaps it is just a problem with the development environment.

Peter 

Jasper-M

unread,
Mar 28, 2017, 2:19:41 PM3/28/17
to scala-user
I think that's almost exactly what the Eclipse Scala IDE already does. I would think other IDEs have similar functionality.

Op dinsdag 28 maart 2017 20:05:01 UTC+2 schreef Peter Wolf:

Clint Gilbert

unread,
Mar 28, 2017, 2:19:44 PM3/28/17
to scala...@googlegroups.com
On 03/28/2017 02:05 PM, Peter Wolf wrote:
> If the IDEA highlighted Implicit usage, perhaps in a different color or
> something, you would know it was there. Hovering with the mouse could
> bring up a explanation of what Implicit was active, and what it was doing.

The Eclipse plugin (ScalaIDE) does this currently. It's very handy.



>
> Implicit is a cool idea. Perhaps it is just a problem with the
> development environment.
>
> Peter
>
> --
> You received this message because you are subscribed to the Google
> Groups "scala-user" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to scala-user+...@googlegroups.com
> <mailto:scala-user+...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

--



signature.asc

Oliver Ruebenacker

unread,
Mar 28, 2017, 2:23:25 PM3/28/17
to Jasper-M, scala-user
IntelliJ IDEA also highlights implicit conversions.

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Oliver Ruebenacker
Senior Software Engineer, Diabetes Portal, Broad Institute

Dennis Haupt

unread,
Mar 28, 2017, 3:05:53 PM3/28/17
to Peter Wolf, scala-user
intellij and i think eclipse are both doing that
 
Gesendet: Dienstag, 28. März 2017 um 20:05 Uhr
Von: "Peter Wolf" <opu...@gmail.com>
An: scala-user <scala...@googlegroups.com>
Betreff: [scala-user] Implicit and IDE Support
--

You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.

Peter Wolf

unread,
Mar 28, 2017, 3:32:17 PM3/28/17
to scala-user
Most Excellent :-D

I use IntelliJ.  How do I enable it?

Thanks
P

Peter Wolf

unread,
Mar 28, 2017, 3:38:36 PM3/28/17
to scala-user
Nevermind, I think I found it

Preferences > Languages & Frameworks > Scala > Performance > Implicit parameters search depth

By default it is set to -1 (off)

Naftoli Gugenheim

unread,
Mar 28, 2017, 7:57:56 PM3/28/17
to Peter Wolf, scala-user

Not sure it’s that. Anyway here are some things IntelliJ gives you:

pasted2

The above underline means an implicit conversion is being used.

I clicked on query and pressed ctrl-shift-Q (for Qonversion?), and here's what I get:

pasted5

It shows all potentially applicable implicit conversions, and bolds and focuses the one that is being used.

Here’s how it works for implicit parameters:

pasted6

I clicked on column and pressed ctrl-shift-P. IntelliJ highlighted the expression that the implicit parameter is being passed to, and is showing me that column’s implicit parameter is filled out to be juDateColumnType, which itself is taking an implicit parameter for which timestampColumnType has been selected.

--

Reply all
Reply to author
Forward
0 new messages