I'm starting a Scala 3 project in IntelliJ IDEA 2022.1.4 (Community Edition).
My problem is that I am getting spurious "Not found errors" as in the image below. Type Fun is in the same package (model), and Intellij evidently knows the type, as all the information about is correctly displayed right below the error message. The program also compiles without error, even though it is marked as an error and reported in IntelliJ's "Problems" pane.
Further info:
The build tool is sbt (but I've had exactly the same problem with Gradle).
The problem disappears when switching to Scala 2, but I would like to avoid that.
I'm also using antlr and stringtemplates in the same project (but I don't know how this could be relevant).
I would be highly grateful for any help.
Related
When I open a maven module with scala code (link) which compiles and runs fine, I get bad error highlights:
Code-complete seems broken as well. How to fix this? (I don't want to switch to SBT since I only want this one module in the project to use scala, and I've tried the "Invalidate Caches / Restart" fix suggested here in vain.)
It is a known problem in IntelliJ with Scala because of the complex type system of scala.
I mostly use sbt. If I encounter such problem, first I compile it with sbt in the command line, most time wrong error highlights disappear.
If this does not help, clear IntelliJ cash and restart it (File -> Invalidated Caches / Restart).
I am using intellij 11 ultimate, using the scala plugin.
Most of my code has red highlights everywhere, meaning IntelliJ cannot properly resolve the keywords.
For example, I added the amazon aws depenency (using sbt) and 1/2 my code is red, and intellisence doesn't work either.
Note: This is happening for many many libraries I am using, and it is a real pain. I am building using the terminal using the sbt command also.
Is there something I am doing wrong? Or is it just a fact of live using scala with intellij?
Update:
I do see this message sometimes:
File '/path/to/app/web/built.sbt' seems to be SBT build file, but there is no external project related to it. Import the corresponing project?
"File -> Invalidate Caches -> Invalidate and Restart" often helps to prevent IntelliJ from showing non-existing Scala errors.
I have no IntelliJ 11, so I do not know if this exists in your Intellij version.
I am using Intellij Idea (v13/v14) for a scala project. IntelliJ is not resolving the classes and showing them in red colour. However, compilation works fine. Because of that, it is not possible to navigate to the other classes from a file.
Can anyone tell me how to fix this problem? It is making me crazy!!!
I would suggest to use IntelliJ 14 and get updated Scala plugin in first place. Then, open the project and invalidate cache.
https://www.jetbrains.com/idea/help/cleaning-system-cache.html
I guess either
The directory containing the source code is not marked as "source root" or
Intellij runtime memory size is small. Try increasing the values in idea.properties,
I created a project based on a valid sbt scala project. However, a few symbols like dependsOn or mapR are not recognized inside intellij 13.
Could anybody please help?
If your code is valid and compiles, then this simply means either your class path is incorrect, or that IntelliJ's error highlighting is not resolving references as expected. Please raise an issue within the Jetbrain's YouTrack system if this is the case.
As a shortcut, this can be achieved with the shortcut alt+enter, and selecting the option "Report Highlighting Error..."
I'm doing Scala web development using the Play framework's scala module, and using Emacs+Ensime to edit the code. Sometimes even when Ensime shows no errors, Play will still show a compilation error for a .scala file (like a type parameter mistake, or even a typo'd override, which is such a basic error).
How can I make ensime show all compilation errors that Play would show?
I'm using Scala 2.8.1, with ensime_2.8.2-SNAPSHOT-0.5.1 (which seemed like the best of the available options when I downloaded it).
I don't think this is supported, because ensime only uses the presentation compiler, which does not do all the checks that the full scalac compiler does.