开发者

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 projec开发者_如何学JAVAts 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


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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜