Troubleshoot common Scala issues
Last modified: 10 August 2022Check the following answers on most common scala/sbt questions that can help you solve compiler, performance or code highlighting issues you might come across while working with your project.
Why is my code highlighted incorrectly?
If the type-aware highlighting highlights the correct code, try to disable the highlighting locally.
Highlight the code and on the main menu select Code | Surround With.
Select the / * _ * /.../ * _ * / option from the list.
The error is not highlighted anymore.
note
The type-aware highlighting
is enabled in your project by default. To disable it, press Ctrl+Alt+Shift+E. If the highlighting level is set to None, then the type-aware highlighting will also be disabled. Use the same shortcut to enable the highlighting.
Why do I get Assertion error when I use the Make Project command?
Change the Scala version to 2.12 and later. We also recommend that you use unique names for private methods in value classes.
Why am I unable to compile my Scala project?
In most cases your project JDK is not compatible with Scala or sbt version, try to change the Scala Compile Server SDK.
Press Ctrl+Alt+S to open Settings/Preferences dialog.
From the options on the left, select Build, Execution, Deployment | Compiler | Scala | Scala Compiler Server.
In JVM SDK field specify the appropriate SDK.
We recommend that you switch to Java 8 SDK since the Scala version 2.12, and sbt versions 1.10 and later are not compatible with older Java SDK versions.
How do I resolve OutOfMemory exceptions when I compile my Scala project?
To fix Out Of Memory
issues with the Scala compiler, increase the heap size in the JVM maximum heap size field of the Scala compiler server settings located in File | Settings/Preferences | Languages & Frameworks.
![Scala server settings Scala server settings](https://resources.jetbrains.com/help/img/idea/2022.1/scala_jvm_heap_size.png)
How do I migrate an IDEA-based Scala project to the sbt project?
You would need to add the build.sbt file to your project, describe your whole project inside build.sbt and then re-import the project.
We recommend that you choose the sbt-based project right from the start.
![New sbt project New sbt project](https://resources.jetbrains.com/help/img/idea/2022.1/scala_project_start.png)
Does IntelliJ IDEA support the sbt's model of integration tests?
When you build sbt projects, keep in mind that the IDEA project model doesn't really have the same concept of configurations as sbt does, so only compile and test are fully supported. For other cases we recommend that you run the build from the integrated sbt shell.
How do I resolve OutOfMemory exceptions in my sbt project?
When your sbt process doesn't have enough memory, increase maximum heap size in the sbt settings (click the located in the sbt projects tool window).
![sbt settings sbt settings](https://resources.jetbrains.com/help/img/idea/2022.1/sbt_heap_size.png)
Thanks for your feedback!