IntelliJ IDEA 2026.2 Help

Scala classes and files

IntelliJ IDEA supports the practice of breaking Scala code into small functional chunks, each kept in its own file. Such files have their own specific icons. You can see those icons in the Project tool window that displays the contents of your project. Some of these icons are also visible in the New Scala Class/File window as you add new items to your project.

Add new Scala files or classes to your project

  1. In the Project tool window (Alt+1), right-click the node in which you want to create a file or a class and select New | New Scala Class/File.

  2. Name the new item and press Enter.

New Scala Class/File window

Note that the name of the file must be the same as the name of the data structure. Also, note that the rule of having only one data structure in the file applies only to the top-level structures. Within them, you can have as many other nested structures as you want.

Scala file icons

Icon

Description

A Scala file that contains only one class or a case class without a companion object.

A Scala file that contains only one class or a case class with a companion object.

A Scala file that contains only one trait without a companion object.

A Scala file that contains only one trait with a companion object.

A Scala file that contains only one enum without a companion object.

A Scala file that contains only one enum with a companion object.

A Scala file that contains only one opaque type with a companion object.

A Scala file that contains only one object.

A Scala file that contains more than one data structure.

16 June 2026