editor doesn't recognize implicits i.e. net.codingwell.scalaguice.InjectorExtensions._
This used to occur in older intellij versions but in latest 2017.2 it occurs almost all the time.
I've code that uses https://github.com/codingwell/scala-guice
import net.codingwell.scalaguice.InjectorExtensions._
And then
val x=injector.inject[XClass]
"inject" is an implicit defined in the InjectorExtensions but it is not recognised by the editor. Effectively it disables autocomplete and also organizing imports incorrectly removes the import.
I tried restarting ,"invalidate caches / restart" (this used to work sometimes in older versions) etc without any luck. Sometimes if I move the import statement around, it starts to work but only for a little while.
Any ideas what might be going wrong? This mainly occurs in scala-test cases I think , where probably there are a lot of implicits.
object InjectorExtensions {
implicit class ScalaInjector(i: Injector) {
def instance[T: Manifest] = i.getInstance(typeLiteral[T].toKey)
def instance[T: Manifest](ann: Annotation) = i.getInstance(typeLiteral[T].annotatedWith(ann))
def instance[T: Manifest, Ann <: Annotation : Manifest] = i.getInstance(typeLiteral[T].annotatedWith[Ann])
....
}
}
请先登录再写评论。
Actually just found that the "injector" type was not correctly recognised by the editor:
This issue needs an investigation. I've created https://youtrack.jetbrains.com/issue/SCL-12432 for this.