.scala File Extension
.scala file contains, how to open and run Scala source code, how Poly supports it, and how it differs from related JVM files. File extension details for .scala
Full Support| File type | Scala source code |
|---|---|
| MIME type | |
| Encoding | Unicode plain text, commonly UTF-8 |
| Operating systems | Windows, macOS, Linux |
| Opens with | IntelliJ IDEA, Visual Studio Code with Metals, Scala CLI, Any text editor |
| Poly support | Yes. Poly recognizes .scala as readable Scala source code. |
| Indexed by Poly | Yes. Poly indexes readable source for exact and semantic search. |
| Preview in Poly | Yes. Scala source opens in Poly's code editor with syntax highlighting. |
| Poly agent | Yes. The Poly agent can read and reason about the source text. |
What kind of file is a .scala?
A .scala file contains source code written in Scala. It is editable text, not compiled JVM bytecode. One file can define packages, imports, classes, traits, objects, functions, values, and other declarations. Scala places few restrictions on source filenames, but projects commonly name a file after its main class, trait, or object, such as Inbox.scala.1
There are no fixed magic bytes. Editors and build tools identify Scala from the suffix, project context, or source syntax. IANA does not register a Scala-specific media type. Poly classifies .scala as readable text/plain.2
.scala does not translate its code. The new name may only cause software to apply Scala syntax rules to incompatible text.How do I open a .scala on my computer?
Any text editor can open .scala files on Windows, macOS, or Linux. IntelliJ IDEA with the Scala plugin and Visual Studio Code with Metals add completion, navigation, diagnostics, formatting, and project-aware tools. Metals also supports editors including Vim, Emacs, Sublime Text, and Helix.3
For a small Scala 3 program, install Scala CLI and run:
scala run hello.scala
This compiles and executes the source, so review unfamiliar code before running it. For an existing project, use its documented sbt, Mill, Maven, Gradle, or Scala CLI workflow so the Scala version, compiler flags, plugins, and dependencies are correct. The official getting-started guide demonstrates scala run with a .scala source file.4
Poly support for .scala
Poly opens .scala files in a read-only, code-friendly viewer with Scala syntax highlighting, word wrap, and in-file search. It indexes readable source for exact and semantic search, so you can find an identifier by name or locate code by its purpose.
The Poly agent can summarize a class, explain a function, or help trace likely behavior. Poly does not compile or execute source, resolve dependencies, or reproduce an IDE's full project model. Keep related source, tests, build definitions, and documentation together when broader context matters.
History of .scala
Scala was developed at EPFL beginning in 2001, and version 1.0 was released in November 2003.5 The language combines object-oriented and functional programming and was designed to interoperate closely with Java. The .scala suffix became the conventional filename marker for its source compilation units.
Scala 2 arrived in March 2006, while Scala 3.0 was released in May 2021.56 The suffix itself does not identify a language version or output platform. Project configuration determines whether code targets the JVM, Scala.js, or Scala Native and which language rules apply.7
Working with .scala and related files
| File or extension | Typical role |
|---|---|
.scala | Ordinary Scala source or a source file run with Scala CLI |
.sc | Tool-specific Scala script or worksheet convention |
.sbt | Scala-based sbt build definition |
.java | Java source that can coexist in JVM projects |
.class | Compiled JVM bytecode, not editable source |
Keep .scala source and build configuration in version control. Treat generated .class files, JARs, JavaScript bundles, and native executables as different artifacts. Decompilation may recover approximate code from some compiled output, but it cannot reliably restore comments, formatting, or every original construct.
Footnotes
- Scala Documentation. Style Guide: Files. Describes compilation units and common
.scalafilename conventions. ↩ - Internet Assigned Numbers Authority. Media Types Registry. The registry contains no Scala-specific media type. ↩
- Scala Documentation. Scala IDEs. Covers IntelliJ IDEA with the Scala plugin, Visual Studio Code with Metals, and other Metals editors. ↩
- Scala Documentation. Getting Started. Demonstrates creating and running a
hello.scalafile with Scala CLI. ↩ - Scala Language Specification. Scala 2.13 Specification: Preface. Records development from 2001, Scala 1.0 in November 2003, and Scala 2 in March 2006. ↩ ↩2
- Scala. Scala 3.0.0. Records the May 14, 2021 release. ↩
- Scala Documentation. JDK Compatibility. Identifies the JVM as Scala's primary platform and Scala.js and Scala Native as supported platforms. ↩