SBT compiled .proto, but IDEA can't recognize the trait built by it?

I use SBT 1.8.2 to compile some .proto. It shows compiling all of them well and generating result to the target dirctory. But when I extend the trait of service generated by the .proto, IDEA can’t do the importing.

I tried all of the steps below:

  1. uninstall all plugins except Scala.
  2. use the previous version IDEA on my laptop.
  3. type import statement manually.
  4. take the demo project from Akka Platform Guide as a template, then add my project files into it.
  5. type package prefix to the class, then the compiler recognize them. It includes every package of the project not only the .rpc. But IDEA can’t show code completion tips.
  6. I tried the demo project of Akka gRPC. it shows the same problem.
    Akka gRPC Quickstart with Scala · Lightbend Tech Hub
  7. IDEA ultimate version 2013.1

I post the problem to the Youtrack, but no answer yet.
IDEA can’t do packages importing which built by SBT with .proto file. : SCL-21118 (jetbrains.com)

How to fix it? thanks.

I assume you use the sbt-akka-grpc plugin.
With this sbt compile or Rebuild Project in IDEA should be enough to re-generate the sources for IDEA to pick up.

1 Like

yes, i add the plugin in plugins.sbt and enable it in build.sbt. i find it generated all trait, class and object into the directory target, mark the directory as source root and generated root. but idea can’t recognize them, and can’t do importing. i tried to fresh the whole sbt project and reload it.

I don’t know why and how to do.