简体   繁体   中英

Scala, Cats, Intellij IDEA: fix syntax & compile errors?

Using the Cats library for Scala in IntelliJ IDEA leads to errors even if terminal SBT works. Can we fix this? Or some workaround that isn't switching editor?

Cats seems to work fine on my IntelliJ 2018.1.4. If it is working in the terminal but not in IntelliJ, it could be because of using in-built IntelliJ compiler. Have you tried enabling Use sbt shell for build and import , which delegates building to SBT:

  1. Open sbt projects tool window: View | Tool Windows | sbt View | Tool Windows | sbt
  2. Click sbt settings icon
  3. Select Use sbt shell for build and import (required sbt 0.13.5+)

Use sbt shell might resolve compilation issues, however note that in-editor error highlighting might still give false positives because it uses custom-built typechecker.


Metals is an alternative that uses Scala proper for both compilation and in-editor error diagnostics.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM