IntelliJ IDEA 10 的 Scala 插件未检测到简单错误?
我知道我一定错过了一些东西,但无法弄清楚是什么。当我按照 scala-plugin 说明创建 scala 项目时,没有检测到任何语法错误。例如:
object MyApp {
val aNumber: Int = "hello"
}
没有检测到任何错误。如果我右键单击并要求它进行编译,那么我会从 scala 编译器收到预期的类型不匹配错误。这只是一个愚蠢的示例,没有标记任何语法错误。对于常规 Java 项目,它工作得很好,因此它必须是特定于 scala 的。
我在 OSX 10.6 和 Scala 2.8.1 Final 上全新安装了 IDEA 10 CE。我已经在项目设置中设置了jdk以及创建项目时的scala home。我有该插件的最新版本(12/2010)。
关于我缺少什么的任何提示吗?
I know I must be missing something, but can't figure out what. When I create a scala project, following the scala-plugin instructions, not a single syntax error is detected. For example:
object MyApp {
val aNumber: Int = "hello"
}
does not detect any error. If I right-click and ask it to compile, then I get the expected type mismatch error from the scala compiler. This is just a silly example, no syntax errors are being flagged. For regular Java projects it works fine, so it must be scala specific.
I have a clean install of IDEA 10 CE on a OSX 10.6 and Scala 2.8.1 final. I have set up the jdk in the project settings as well as the scala home when creating the project. I have the latest version of the plugin (12/2010).
Any hint on what I'm missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您必须启用错误突出显示。打开设置/代码风格/Scala/其他设置/启用实验错误突出显示
You have to enable error highlighting. Turn on Settings/Code Style/Scala/Other settings/Enable experimental error highlighting
此处也适用(IntelliJ 10.0.1、Scala 2.8.1、OpenJDK、Ubuntu 10.10 64 位)。
如果您想要更多类型检查,您还可以在“设置”中勾选“启用实验错误突出显示(可能显示许多错误的红色代码)”,但这对您的情况不会产生影响,尽管它在我的情况下对于大型代码库。
Works here too (IntelliJ 10.0.1, Scala 2.8.1, OpenJDK, Ubuntu 10.10 64bit).
If you want more type checking you can also tick "Enable experimental error highlighting (possibly shows many wrong red code)" in the Settings, but this shouldn't make a difference in your case, although it works perfectly in my case for a large code base.
在项目结构>模块> [您的项目名称]>依赖项选项卡,您是否列出了 scala-compiler-[某些版本]?
请参阅此处探索项目结构
In project structure > modules > [your project name] > dependencies tab, do you have scala-compiler-[some version] listed?
See the Exploring the Project Structure here
Ubuntu 10.10 64 位上的 intelliJ IDEA 10.0.1 + scala 2.8.1。
它显示类型不匹配错误
intelliJ IDEA 10.0.1 + scala 2.8.1 on Ubuntu 10.10 64bit.
It shows a type mismatch error
对于 Mac OS 上的 2019.1 CE:
首选项 |构建、执行、部署 |编译器| Scala编译器
勾选了选项:
Features->Experimental Features
For 2019.1 CE on Mac OS:
Preferences | Build, Execution, Deployment | Compiler | Scala Compiler
Checked the option:
Features->Experimental Features
在 IntelliJ Idea 的最新版本(即 2022 版本等)中,选择“错误突出显示”下拉列表中的“内置”错误突出显示选项,而不是“编译器”选项,可以通过“首选项”-> “语言和框架”-> “斯卡拉”-> “编辑器”屏幕。
In the recent versions of IntelliJ Idea (i.e., 2022 version etc), select the "Built-in" Error highlighting option instead of the "Compiler" option in the
Error Highlighting
dropdown which can be accessed via "Preferences" -> "Languages & Frameworks" -> "Scala" -> "Editor" screen.