IntelliJ IDEA Scala 插件的语法高亮显示 Scala 包为红色
这有点奇怪,我有 IntelliJ IDEA 10、一个相当新的 Scala 插件和 sbt 0.7.7。我已经在同一个项目上使用相同的设置一段时间了,语法突出显示效果非常好。
从 sbt 进行几次清理/编译后(我不太确定该操作),Scala._ 中的所有内容都是红色的。例如,List()
是红色的,但是当我导入 scala.collection._
时它会被修复。该项目在IDEA和SBT中编译都没有任何问题。可能是什么问题?
(新/其他项目在相同的设置上都可以,所以我想我搞砸了一些东西,但我不知道在哪里寻找它)
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我从来没有找到单一的解决方案,所以我通常尝试所有的事情。
使缓存无效后,重新启动时 IDEA 将重新索引所有类文件。
通常我会尝试
然后如果它不起作用去使缓存无效。如果仍然不起作用(而且几乎总是如此),请尝试删除以下目录,然后再次从上面执行 #1/#2:
I've never found a single solution to this, so i generally try all the things.
After invalidating caches, upon restart IDEA will re-index all of your class files.
Usually I'll try
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:
在项目设置中,将 jar 添加到 IDE 的依赖项中,然后您就会得到红色。
SBT是一回事,IDEA是另一回事,他们用自己的方式来编译scala。 IDEA 的一些 sbt 插件也只是将 sbt 命令行挂接到 IDEA 的面板上。
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.
当 SBT 和 IDEA 项目不同步时,有时会发生这种情况。只需再次运行 SBT Idea 处理器 - 这将重新生成您的 Idea 项目文件。
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.