Reputation: 302
I am using IDEA 2017.2.5 to develop in Scala with the SBT plugin. I've been unable to get Scala's code inspection to work correctly. I get lots of seemingly arbitrary errors on valid Scala code, such as "Cannot resolve symbol" or "Type mismatch". Also, lots of imports which I'm definitely using are marked as unused and grayed out.
For example, the following code resolves to " world"
but produces a "Cannot resolve symbol toLowerCase" error:
val s = "Hello, World".split(",").last.toLowerCase
I have tried File -> Invalidate Caches / Restart, reinstalling the SBT plugin, using different Scala versions, with no luck. Turning off type-aware highlighting makes some of the errors go away, but not all of them.
The following SO posts seem similar:
How can I resolve this?
Upvotes: 1
Views: 378
Reputation: 4585
If you only recently upgraded your project after using IntelliJ for some time, you might want to force it to regenerate its index by removing your .idea
folder and re-importing the project. I've had some luck in the past with this trick.
If you want to make sure not to mess anything up, rename the folder instead of removing it:
> cd /path/to/project
> mv .idea .idea-backup
In case of problems, you can always rename .idea-backup
back into .idea
.
Upvotes: 1