# Scala クラスとファイル

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/ja-jp/help/idea/llms.txt).

> **TL;DR**
> 必須プラグイン：   Scala  ： [インストール方法](get-started-with-scala.html#scala_plugin)

IntelliJ IDEA では、Scala コードを小さな機能ブロックに分割し、それぞれを独自のファイルに保存する方法をサポートしています。 このようなファイルには、それぞれ独自の [特定のアイコン](#scala-file-icons)があります。 これらのアイコンは、プロジェクト内容を表示する   プロジェクト   ツールウィンドウで確認できます。 これらのアイコンの一部は、   新規 Scala クラス/ファイル   ウィンドウで [プロジェクトに新しい項目を追加する](#add-new-scala-files-classes)際にも表示されます。

Procedure: プロジェクトに新しい Scala ファイルやクラスを追加します

1. プロジェクト   ツールウィンドウ（ `Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Ctrl+1` (NetBeans), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))）で、ファイルまたはクラスを作成したいノードを右クリックし、  `新規｜新規 Scala クラス/ファイル`  を選択します。

2. 新しい項目のお名前を入力し、 `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)) を押してください。

![新規 Scala クラス/ファイルウィンドウ](https://resources.jetbrains.com/help/img/idea/2026.3/scala_new_class_window.png)

ファイルの名前はデータ構造と同じである必要があります。 また、ファイルに 1 つのデータ構造のみ含めるというルールはトップレベルの構造だけに適用されることにご注意ください。 その中では、任意の数のネストされた構造を持つことができます。

## Scala ファイルのアイコン

|  アイコン  |  説明  |
| --- | --- |
|  ![](https://resources.jetbrains.com/help/img/idea/2026.3/scalaCommunity.org.jetbrains.plugins.scala.images.expui.classScala.svg)  |  コンパニオン (see more in the note) オブジェクトのない  `class`  または  `case class`  のみを含む Scala ファイル。  |
|  ![](https://resources.jetbrains.com/help/img/idea/2026.3/scalaCommunity.org.jetbrains.plugins.scala.images.expui.classObjectScala.svg)  |  コンパニオン (see more in the note) オブジェクトのある  `class`  または  `case class`  のみを含む Scala ファイル。  |
|  ![](https://resources.jetbrains.com/help/img/idea/2026.3/scalaCommunity.org.jetbrains.plugins.scala.images.expui.traitScala.svg)  |  コンパニオン (see more in the note) オブジェクトのない  `trait`  のみを含む Scala ファイル。  |
|  ![](https://resources.jetbrains.com/help/img/idea/2026.3/scalaCommunity.org.jetbrains.plugins.scala.images.expui.traitObjectScala.svg)  |  コンパニオン (see more in the note) オブジェクトのある  `trait`  のみを含む Scala ファイル。  |
|  ![](https://resources.jetbrains.com/help/img/idea/2026.3/scalaCommunity.org.jetbrains.plugins.scala.images.expui.enumScala.svg)  |  コンパニオン (see more in the note) オブジェクトのない  `enum`  のみを含む Scala ファイル。  |
|  ![](https://resources.jetbrains.com/help/img/idea/2026.3/scalaCommunity.org.jetbrains.plugins.scala.images.expui.enumObjectScala.svg)  |  コンパニオン (see more in the note) オブジェクトのある  `enum`  のみを含む Scala ファイル。  |
|  ![](https://resources.jetbrains.com/help/img/idea/2026.3/scalaCommunity.org.jetbrains.plugins.scala.images.expui.typeObjectScala.svg)  |  コンパニオン (see more in the note) オブジェクトのある  `opaque type`  のみを含む Scala ファイル。  |
|  ![](https://resources.jetbrains.com/help/img/idea/2026.3/scalaCommunity.org.jetbrains.plugins.scala.images.expui.objectScala.svg)  |   `object`  のみを含む Scala ファイル。  |
|  ![](https://resources.jetbrains.com/help/img/idea/2026.3/scalaCommunity.org.jetbrains.plugins.scala.images.expui.scalaFile.svg)  |  複数のデータ構造を含む Scala ファイル。  |

