I am following the akka-in-action tutorial and in chapter 2, there is a class (https://github.com/RayRoestenburg/akka-in-action/blob/master/chapter2/src/main/scala/com/goticks/RestInterface.scala):
trait RestApi extends HttpService with ActorLogging { actor: Actor =>
import context.dispatcher
import com.goticks.TicketProtocol._
...
The import context.dispatcher
is never used, but it is defined with a comment:
/**
* Returns the dispatcher (MessageDispatcher) that is used for this Actor.
* Importing this member will place an implicit ExecutionContext in scope.
*/
implicit def dispatcher: ExecutionContextExecutor
However, IntelliJ keeps marking the import as "unused" and removing it upon "optimize imports" causing an error value pipeTo is not a member of scala.concurrent.Future[Any]
.
Is there a way to tell IntelliJ that this import is not intended to be "used", but just to simply provide a context?
Or should the tutorial be updated to not use such "unused import"?
This looks like issue SCL-9326 to me. IntelliJ 15 has a nice fix for this: press alt-enter (on a Mac) and select "mark this import as always used in this project".