parsa
parsa

Reputation: 2668

IntelliJ IDEA Scala plugin's syntax highlighting displays Scala packages in red

This is a bit weird, I've got IntelliJ IDEA 10, a fairly recent Scala plugin on it and sbt 0.7.7. I've been using the same setup on the same project for a while and syntax highlighting worked perfect.

After a few clean/compiles from sbt (I'm not really sure about the action), everything from Scala._ is red. For instance, List() is red but when I import scala.collection._ it gets fixed. The project compiles without any problems in both IDEA and SBT. What may be the problem?

(new/other projects are OK on the same setup so I guess I've messed up something but I have no clue where to look for it)

Thanks

Upvotes: 5

Views: 5179

Answers (3)

tysonjh
tysonjh

Reputation: 1339

I've never found a single solution to this, so i generally try all the things.

  1. sbt gen-idea (to recreate IDEA project meta-data)
  2. File > Invalidate Caches ... > Invalidate and Restart

After invalidating caches, upon restart IDEA will re-index all of your class files.

Usually I'll try

sbt> clean
sbt> gen-idea

Then if it didn't work go for invalidating caches. If that still doesn't work (and it almost always does) try deleting the following directories and then perform #1/#2 from above again:

  • target
  • project/target
  • .idea
  • .idea_modules

Upvotes: 7

Johan Prinsloo
Johan Prinsloo

Reputation: 1188

This sometimes happens to me when the SBT and IDEA projects get out of sync. Simply run the SBT Idea processor again - this regenerates your Idea project files.

Upvotes: 2

DarrenWang
DarrenWang

Reputation: 478

at project Settings, add the jars to its dependencies of IDE, then you will get the red away. SBT is one thing, IDEA is another, they use their own way to compile scala. some sbt plugin for idea is also something that just hook sbt command line to idea's panel.

Upvotes: 2

Related Questions