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?
Asked
Active
Viewed 714 times
5
-
this might help? https://stackoverflow.com/questions/34695616/false-errors-when-using-cats-library-in-intellij – suicide Jun 26 '18 at 12:10
1 Answers
5
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:
- Open sbt projects tool window:
View | Tool Windows | sbt
- Click
sbt settings
icon - 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.

Mario Galic
- 47,285
- 6
- 56
- 98
-
Good improvement, thanks! Can we also somehow fix syntax highlighting and "live" error reporting? (intellij's sidebar errors) – ticofab May 29 '18 at 16:02
-
-
After invalidatin caches / restart, IntelliJ still will report errors unfortunately :( – ticofab May 30 '18 at 09:07
-
@ticofab Try the nuke option, where you `rm -fr .idea` and re-import the project. – Mario Galic May 30 '18 at 09:41
-
I was tackling this issue for hours now, and then I updated my IDE from 2017 to 2018 + used the ```Use sbt shell...``` option -- This solved all my issues and now all my red squiggly lines are gone + my autocomplete works. :) – Chau Jul 22 '18 at 23:32