IntelliJ not indexing Scala right


  • Banned

    I'm working on a Scala project, and picked IntelliJ IDEA as my IDE of choice. It's mostly OK (go to definition, find usages and breakpoints all work, and I don't need more), but a couple things are not the way I like, and others are outright broken.

    One of broken things is indexer. It sees most of my program, and most of standard library. But I see red text very often, for example Option.get and Regex.findFirstMatchIn. It's really quite random and I haven't noticed any pattern yet. Is there some trick to it? Are there some constructs I should avoid to make indexer's life easier? Some configuration option I forgot about? Version mismatch between IntelliJ, JDK, Scala and sbt?

    Also, I've noticed that if something is val, the debugger doesn't see it and I can't check its value, but if I change it to var, it works. Is this normal?

    Also also, any other IDEs you recommend?



  • @gąska that doesn't sound right at all. I'm running latest IDEA with Scala plugin and don't see this. Maybe some project setup issues?


  • Banned

    @homobalkanus yeah, I know. I'm the kind of guy who has the most bizarre problems with no apparent solution. Just today I've wasted half a day figuring out why my app, which works for a colleague next to me, crashes with NoSuchMethodException on some Scala internals before it even reached any of our code.

    Anyway. I use sbt for building my project, and checked the "use sbt" checkbox in project settings. My sbt version is 1.1.1, but the project has been configured for version 0.13.5. Might this be the reason for the weirdness?



  • @gąska said in IntelliJ not indexing Scala right:

    Anyway. I use sbt for building my project, and checked the "use sbt" checkbox in project settings. My sbt version is 1.1.1, but the project has been configured for version 0.13.5. Might this be the reason for the weirdness?

    I've never used Scala, but just because it's Java-based I'm going to answer Yes.



  • @gąska it's possible. It's always a good idea to use the same version as the build system anyway. Also, check that Scala version matches. Even minor versions have bytecode incompatibility


  • Considered Harmful

    @homobalkanus said in IntelliJ not indexing Scala right:

    @gąska it's possible. It's always a good idea to use the same version as the build system anyway. Also, check that Scala version matches. Even minor versions have bytecode incompatibility

    Doesn't that defeat the purpose of minor versions?



  • @pie_flavor it does. It also results in libraries having to include Scala version in their names so that it's easier to see which version they're compatible with.