Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 569
parsa Avatar asked Jun 28 '11 10:06

parsa


People also ask

How do I enable Scala in IntelliJ?

To install Scala plugin, press Ctrl+Alt+S , open the Plugins page, browse repositories to locate the Scala plugin, click Install and restart IntelliJ IDEA. Now you can successfully check out from VCS, create, or import Scala projects.

How do I select Scala version in IntelliJ?

Press Ctrl+Alt+S to open Settings/Preferences dialog. From the options on the left, select Build, Execution, Deployment | Compiler | Scala | Scala Compiler Server. In JVM SDK field specify the appropriate SDK.


2 Answers

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.

like image 33
DarrenWang Avatar answered Nov 02 '22 22:11

DarrenWang


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
like image 103
tysonjh Avatar answered Nov 03 '22 00:11

tysonjh