4

I've just tried IntelliJ IDEA 12 with the Scala plugin, but it doesn't find and highlight errors in my code. I can for example write arbitrary code in a method and it looks like everything is fine. Is IDEA not able to do this? Or do I have to configure something special?

1
  • I have IDEA 12 with the Scala plug-in running just fine. Can you look at your plug-ins and see if it is enabled? Which version are you using? Have you enabled Type-aware highlighting? Commented Jan 22, 2013 at 15:16

2 Answers 2

16

IDEA's Scala plug-in is not equivalent to the compiler in type-checking your source code, but it does pretty well. The one thing you'll want to do (unless, perhaps, your hardware is not fairly current and high-performance) is turn on "Type-Aware Highlighting."

If you look in the lower-right-hand corner of the IDEA window (when you're editing a project with Scala enabled) you'll see one of two icons, both of which take the form of a square-bracketed bit of text. That text is either blank on a yellow background or the letter T on a green background. Clicking it toggles between those two states. When the green T is displayed, Type-Aware highlighting is on.

Give that a try.

Sign up to request clarification or add additional context in comments.

6 Comments

Even with type-aware hilighting on, IDEA will occasionally (rarely actually) fail to catch some errors, and more commonly will also red-line perfectly good code. This is due to the plugin using its own typechecker rather than the compiler. Just a consequence of the tooling for scala still not being quite as polished. Installing the SBT plugin and running ~compile or ~test in that window tends to be a big help.
@ChuckAdams: Indeed. That's what I said, albeit less precisely than I should have.
The false positives for Scala type-aware tends to be on implicits, so I just ignore if it looks implicit related.
Thanks. That is what I was looking for. Some pictures and details in the IntelliJ Scala blog.
Furthermore, even when the type-aware highlighting is on, IntelliJ can be in "power saving" mode. You can toggle that via the little face icon. This is notable because it's particularly hard to find... You can't find it through the standard settings dialog... More information about "power save" mode exists in IntelliJ's status-bar documentation.
|
0

Simply updating the plugin version could fix the problem. Old or install/initial plugins may not contain relevant support.

Determining Scala plugin version in Settings: Determining Scala plugin version in Settings

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.