IntelliJ complaints about detach directive

71 vues
Accéder directement au premier message non lu

Jakub Kahovec

non lue,
15 févr. 2015, 12:55:0715/02/2015
à 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

non lue,
16 févr. 2015, 17:33:3716/02/2015
à 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

non lue,
21 févr. 2015, 07:35:2721/02/2015
à 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 )
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message