IntelliJ IDEA Scala 插件的语法高亮显示 Scala 包为红色

发布于 2024-11-18 00:00:17 字数 320 浏览 4 评论 0原文

这有点奇怪,我有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

演多会厌 2024-11-25 00:00:17

我从来没有找到单一的解决方案,所以我通常尝试所有的事情

  1. sbt gen-idea(重新创建 IDEA 项目元数据)
  2. File >使缓存无效...>>无效并重新启动

使缓存无效后,重新启动时 IDEA 将重新索引所有类文件。

通常我会尝试

sbt> clean
sbt> gen-idea

然后如果它不起作用去使缓存无效。如果仍然不起作用(而且几乎总是如此),请尝试删除以下目录,然后再次从上面执行 #1/#2:

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

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
别念他 2024-11-25 00:00:17

在项目设置中,将 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.

浅沫记忆 2024-11-25 00:00:17

当 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文