One fine day IntelliJ
started highlighting my working Scala
code in red. While following commands run without a hitch, IntelliJ
thinks that code is full of errors an missing a lot of dependencies
.
sbt clean
sbt reload
sbt update
sbt compile
sbt assembly
It reports a lot of Cannot resolve symbols
in imports
, classes
and method-calls on objects
like the following. Moreover, it thinks a lot of imports are unused (for the symbols that it can't find)
Interestingly, all this is happening in only one of my projects (that contains two submodules
inside parent module), while other Scala
projects (including those containing submodules
) are working fine.
Things that I've tried without luck:
rm -rf
) build-related directories like .idea
, target
, ~/.ivy2/caches
Invalidate Caches / Restart...
IntelliJ IDEA
and Scala
plugin to latest versionsIntelliJ
, reboot the PC (!)I'm using:
My project configurations are:
Once again, I'd like to remind that my Scala
code is completely functional and that I'm able to run the JAR
generated by sbt assembly
elsewhere without an issue.
It means that the files exist locally, but are not in the repository, and are not scheduled for addition. With other words, the files are not under version control. There is not really a problem since the files can just be added to the VCS if desired.
If you are referring to the file name being in red, that indicates there was a Version Control System (VCS) merge conflict (or the file was changed as part of two different change lists and has not yet been acknowledged).
Green highlighting means Language Injection (HTML flavor in your case). In such fragments you will have inspections/code completion specific to the injected language. Automatic injection rules can be configured at "Settings | Language Injections".
This solution worked for me: Why does intellij IDEA highlight build.sbt?
Go to the menu: File > Invalidate Caches/Restart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With