Developing with Intellij

178 views
Skip to first unread message

Charlie Evans

unread,
Apr 21, 2016, 8:04:00 AM4/21/16
to Akka User List
Hi all,

I just switched from eclipse to intellij for scala development. The sbt plugin is very handy but Intellij can't seem to handle the akka http routes and implicits. In eclipse the code is fine and sbt compiles the code just fine. Is there any settings I can change to make Intellij handle everything better and get rid of these red lines?

Thanks

Konrad Malawski

unread,
Apr 21, 2016, 8:07:03 AM4/21/16
to akka...@googlegroups.com, Charlie Evans
You didn't say which versions of things you're using, please include such info :-)

For me it works, all routes "green" in Intellij 15-EAP.
I've been using the gen-idea plugin, but importing from existing also should work - others on the team work like that.

-- 
Konrad `ktoso` Malawski
Akka @ Lightbend
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Charlie Evans

unread,
Apr 21, 2016, 8:16:11 AM4/21/16
to Akka User List, charles...@gmail.com
Thanks for the speedy reply. Sorry - I'm using IntelliJ IDEA 2016.1.1 and latest akka with scala 2.11.7.

I just tried a little test project and seem to have found the culprit - https://github.com/hseeberger/akka-http-json.

Mixing Json4sSupport into my route class is what's causing the apparent errors. But still compiling.

An example of an error is with my implicit ExceptionHandler where it says expected: ExceptionHandler.PF, actual PartialFunction[Throwable, Future[HttpResponse]].
Also in the routes next to ~ I'm seeing StandardRoute doesn't conform to expected type HttpRequest.

Any ideas?

Thanks

Konrad Malawski

unread,
Apr 21, 2016, 8:18:18 AM4/21/16
to akka...@googlegroups.com, Charlie Evans, charles...@gmail.com
No idea, I'm not developing with Heiko's lib on a daily basis.
Best would be to prepare a reproducer project and tell IntelliJ about it probably (they're *very* responsive and awesome).

-- 
Konrad `ktoso` Malawski
Akka @ Lightbend

Giovanni Alberto Caporaletti

unread,
Apr 21, 2016, 9:05:19 AM4/21/16
to Akka User List, charles...@gmail.com
Intellij seems to be allergic to magnets and macros.

All the "fake" red in my code is where i use directives or shapeless. The parameters directive is always red for me (too many arguments error, doesn't see the magnet).

Last time I used ensime it was even worse though, it couldn't see a number of implicits (probably because they depended on shapeless). 

I guess I gave up on not having red code in the ide and started looking more at the compiler errors. 

Konrad Malawski

unread,
Apr 21, 2016, 9:09:56 AM4/21/16
to akka...@googlegroups.com, Giovanni Alberto Caporaletti, charles...@gmail.com
All the "fake" red in my code is where i use directives or shapeless. The parameters directive is always red for me (too many arguments error, doesn't see the magnet).

There is zero macros and zero shapeless in the routing DSL – we rewrote the routing infra Spray had in Akka HTTP to _not_ depend on shapeless (for this reason and also to allow users to pick the version of shapeless they want (i.e. not lock them into an old version at any point in time)).

The magnet pattern indeed is there, but like I said it all works for me – please show a minimised reproducer so we can look at it, or better – the intellij team can look at it :-)

Improving the world takes a little bit of effort, please help :-)

I guess I gave up on not having red code in the ide and started looking more at the compiler errors. 

I'd really not want to leave you as is with red code, let's have a reproducer and see why it's red. Thanks in advance!

-- Konrad

Giovanni Alberto Caporaletti

unread,
Apr 21, 2016, 9:40:19 AM4/21/16
to Akka User List, para...@gmail.com, charles...@gmail.com
Sure Konrad, I didn't mean to be rude, sorry :) 
I even got my first - ultra-simple - commit merged in akka (very happy :), I'm TrustNoOne on github).

It's just that basically scala code in intellij and any other ide as well has been red (for a reason or another) for years for me, it's something I don't even think about or see as a problem anymore .
In fact the libraries that cause the errors are the very ones I love, e.g. akka-http/spray, shapeless etc. (I know akka doesn't use shapeless anymore, the errors I was talking about are unrelated, I use both akka-http and shapeless in my code, separately).

This is a simple reproducer that's red for me:
parameters('a.as[Int], 'x.as[Int])
The error is: too many arguments for method parameters (ParameterDirectives.ParamMagnet) 


there already are a lot of issues related to red code in akka in the scala plugin's issue tracker (e.g. https://youtrack.jetbrains.com/issue/SCL-9930), I thought I didn't need to open another one.

Please let me know if you think there's something more I could do (the time I have approaches zero - startup guy - but I try to do what I can :)) 

On a different note, since we're discussing this, If I should say the main reason why I'm always thinking about not using an ide anymore, it's the huge cpu usage and general non-responsiveness. Most of the times it takes *seconds* to do simple things like
starting a test or opening a contextual menu (right click). I don't think this is a specific issue though, it's a general slowness of the ide. I don't know how I could mention it in a issue though, it's too broad.
Reply all
Reply to author
Forward
0 new messages