IntelliJ complaints about detach directive

71 views
Skip to first unread message

Jakub Kahovec

unread,
Feb 15, 2015, 12:55:07 PM2/15/15
to spray...@googlegroups.com
Hi,

I'm using Spray (1.3.2) in IntelliJ with latest Scala plugin and when I want to use detach with implicit execution context 


private implicit val executionContext = actorRefFactory.dispatcher

get {
detach() {
complete {
.....
}
}
}

it complaints about detach directive "Cannot resolve reference  detach with such signature" and Unspecified value parameters; dm : DetachMagnet.

In the sbt console it compiles without errors and runs just fine so it might be a bug in the Scala plugin but I haven't had this problem with any other library. 

So I just wanted to ask if anyone of you has experienced a similar problem.

Thank you 

Jakub 

Jim Hazen

unread,
Feb 16, 2015, 5:33:37 PM2/16/15
to spray...@googlegroups.com
I've seen this too with the IntelliJ plugin.  I'm guessing it has to do with the plugin's support for the magnet pattern that Spray is using.  The implicit def fromUnit(u: Unit)(implicit dm2: DetachMagnet2) is particularly complex.  I'm guessing that the Scala plugin isn't able to match detach() to that implicit, whereas the Scala compiler can.

You can make the squiggles go away by simply updating your detach directive to include the executionContext.  In your case.

detach(executionContext) {...}

This would then match the more regular implicit

implicit def fromExecutionContext(ec: ExecutionContext)

I'm guessing this more normal usage of implicits is better supported by the plugin, cuz that works for me.

Jakub Kahovec

unread,
Feb 21, 2015, 7:35:27 AM2/21/15
to spray...@googlegroups.com
That's what I ended up with eventually. It'd be nice though if this is supported by the plugin directly ( I submitted it as a bug to the Intellij Scala Plugin tracker )
Reply all
Reply to author
Forward
0 new messages