New -> Scala Class available for main source set, but not test

I've recently developed an issue where the New -> Scala Class menu item is no longer appearing in the Project view under my test source set. It still appears under the main source set for the same module, though. This is with a Gradle project.

The only thing I can think of that might have triggered it was switching back and forth between two feature branches on Git. One of them did add a dependency on ScalaCheck to the build.gradle file, but otherwise the module's configuration should have been unchanged. Creating Scala files in test had previously worked under both branches, too.

4 comments
Comment actions Permalink
Official comment

Please make sure that your soruces / tests are marked as "Sources Root" / "Test Sources Root", correspondingly. You can verify that by opening Project Structure / Modules, selecting a module, and then looking at the Sources tab. Alternatively, you may right click your "src" or "test" directory in Project View and choose "Mark Directory as".

The directories are supposed to be marked appropriately during the process of importing ("opening") a Gradle project. If that's not the case, please create a ticket in https://youtrack.jetbrains.net/issues/SCL and provide steps to reproduce the problem.

Comment actions Permalink

Forgot to mention, I was using Ultimate 2017.3.4. I tried upgrading to the latest (2018.1.5), and now I've lost it for all my source sets.

0
Comment actions Permalink

Thanks, Pavel.  I had all of that sorted out. It turned out to be something else: I needed to right-clicking on the source sets and choosing "Add Framework Support..."

0
Comment actions Permalink

Good. However, if you use a Grade project and it can actually compile Scala files from command prompt, then Scala support should be added automatically on opening the project in IDEA (or after "refreshing" the project in IDEA, if you added Scala subsequently, after opening the project). If that's not the case, please feel free to create a corresponding ticket in YouTrack.

0

Please sign in to leave a comment.