Go To Implicit Conversion feature announcement.

From build 0.3.1626.
1. Select expression.
2. Press Alt+Ctrl+Shift+I
3. You will see possible conversions list, actual conversion will be highlited green.
screenshot.bmp
I hope this can be helpful.

Best regards,
Alexander Podkhalyuzin.

11 comments
Comment actions Permalink

Beautiful! Thank you very much!

Impatient me wonders why 0.3.1626 doesn't show up on the Scala Plug-in Nightly Build page, yet?

Randall Schulz

0
Comment actions Permalink

Ok, wait about 20 minutes (may be much more, because of build order). I just have ran nightly build configuration.

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

are the x stackoverflow-errors fixed yet?

0
Comment actions Permalink

Just some of them. I'll try to fix today other known SOEs.

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

while i'm at it: i have a problem in my code. both the compiler and your plugin tell me that a method is not being found (it's an implicit def). however, when pasting the exact same code into another class, it works. i can rule out import problems because even if i declare the implicit right above the code in question, it doesn't work.
can the plugin help me figure out why the implicit def is not found?

0
Comment actions Permalink

Plugin tells only what implicit conversions were found. It's not explain why, and also it's not explain why not found.
Possible feature, which can help, will be added: autoimport implicit conversion, but not soon.

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

A guess: You did not explicitly specify the return type of the implicit conversion? In this case (which is not recommended) the implicit will only be applied if its definition precedes the places in the code where it's needed and then only if the inferred return type is really what you think it is.

I don't personally recommend relying on type inference for method return types unless they're very simple and a person can readily ascertain the type at a glance. In addition to the aforementioned problem with implicits, it can also lead to the inference of a more specific type than you really want (e.g., an implementation type rather than an abstract type).


Randall Schul

0
Comment actions Permalink

i don't use implicits for conversion, i use them to "inject" methods to objects, like "toOption" to AnyRef, or contains(x) and ifDefined(e => e.something, orElse) to Option

0
Comment actions Permalink

very helpful indeed. but maybe allow just placing the cursor on the (simple) expression (not having to select)?

also, if in 'foo.bar', bar is a method through an implicit conversion, can we have something like ctrl-alt-shift-b to go to the implicit conversion definition? sometimes the method is for another valid type (so ctrl-b on the method itself doesn't tell us how it got converted). E.g.: I have an implicit conversion asFile(url: Url). So my code can have 'url.getAbsolutePath', I'd like for other developers to be able to understand where the conversion URL=>File was defined (e.g., to be able to use it someplace else)

0
Comment actions Permalink

You may want to think of them as augmenting existing types ("Pimp my Library"), but you're defining conversions nonetheless and you need to be aware of the real mechanism underlying the technique.

RRS

0
Comment actions Permalink

This feature of course will be improved, I'm not sure in which direction.
For your example foo.bar, you can select expression 'foo' and then you'll see possible and actual conversions.

Best regards,
Alexander Podkahlyuzin.

0

Please sign in to leave a comment.