Code files open in Monaco, the editor engine behind VS Code, with highlighting for the file's language. They are ordinary text files, so versions, links, sharing and agent edits work the same as they do for a note.

## What opens in the code editor

| Group | Extensions |
|---|---|
| JavaScript and TypeScript | `.js` `.jsx` `.ts` `.tsx` `.mjs` `.cjs` |
| Python, Go, Rust | `.py` `.go` `.rs` |
| JVM and .NET | `.java` `.kt` `.cs` |
| C family | `.c` `.cpp` `.h` `.hpp` |
| Scripting | `.rb` `.php` `.swift` `.sh` `.bash` `.zsh` |
| Web | `.css` `.scss` `.sass` `.less` |
| Data and query | `.json` `.yaml` `.yml` `.toml` `.xml` `.sql` |

The language comes from the extension. Monofile treats an extension it does not recognise as plain text and opens the file in the WYSIWYG editor, which is rarely what you want for code. Rename it to `.py`, `.ts` or whatever it is.

The raw toggle, <kbd>Cmd</kbd> + <kbd>Shift</kbd> + <kbd>V</kbd> (<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>V</kbd> on Windows and Linux), opens a markdown, HTML or canvas file in the code editor.

## What the editor gives you

- Syntax highlighting, a minimap, and line numbers.
- Bracket pair colourisation and always-on bracket matching, plus indentation and bracket guides.
- Auto-closing brackets and quotes, and automatic indentation.
- Formatting as you type and on paste, two-space indents by default with detection of the file's existing indentation.
- Code folding, word wrap, whitespace shown inside a selection, and highlighting of every other occurrence of the selected word.
- A find and replace widget seeded from your selection.
- Suggestions as you type and on trigger characters.
- Your Monofile theme, light or dark and any family, applied to the code editor too.

## What it does not do

Monofile is a workspace, not an IDE. The code editor has no language server. Nothing resolves an import to another file of yours or type-checks a project, and there is no linting, refactoring or go-to-definition across files. Suggestions come from the editor itself, with no knowledge of your project.

It also does not run anything. To execute commands against your files, use the `bash` tool, described in [[File and Shell Tools]].

Monofile does not validate content either. A `.json` file with a trailing comma saves without complaint; Monofile stores the file as text, and only whatever reads it later can reject it.

## Code files are text files

Everything general about a Monofile file applies to code:

- Every write captures a version, so you can compare and roll back.
- An agent can read, edit and create code files, and its changes arrive as a diff you keep or revert.
- You can share a file by link or publish it in a folder.
- `[[Wiki-links]]` in a markdown file can point at a code file, and the code file shows up in that note's backlinks.
- A text file over 5 MB shows a warning before it opens, since a file that large is rarely one you meant to edit by hand.

## Side by side and in sync

Split a pane and open the same file in both. The views stay in step as you type, and the second view is read-only so there is one writer. Open two different files for a side-by-side comparison. See [[Panes and Tabs]].

> [!TIP]
> Saving is automatic. The editor writes shortly after you stop typing. The small dirty and saved indicator is only a hint; if you need to be sure a write landed, check the version history.

## Next steps

:::cards
- [[Supported File Types]] — The full extension to editor map, and what each editor can do.
- [[Data Files]] — JSON, YAML, TOML, XML and friends: editing, validation and formatting, and where CSV stands.
- [[Panes and Tabs]] — Split panes, tabs, and the layout that persists between sessions.
- [[How Versioning Works]] — Automatic version capture on every write, and how long versions last.
:::
