# File Editor

Fluidd includes a built-in code editor powered by Monaco (the engine behind VS Code) for editing Klipper configuration files, G-code, and other files directly from your browser.

> [!WARNING]
>
> **Performance**
>
> The editor handles most config files without issue. For very large G-code files (over \~5 MB), the editor may be slow to load and syntax highlighting may be limited. For large G-code files, the [File Manager](<https://docs.fluidd.xyz/features/file-manager/index.md>) and G-code preview are better tools than the editor.

## Syntax highlighting

Syntax highlighting is provided for the following file types:

| File Type | Highlighted Elements |
| --- | --- |
| **Klipper config** (`.cfg`) | Section headers, key names, values, comments, SAVE\_CONFIG block markers, and embedded G-code templates |
| **Moonraker config** (`.conf`) | Section headers, key names, values, and comments |
| **G-code** (`.gcode`, `.g`, `.gc`, `.gco`, `.ufp`, `.nc`) | G/M/T/N command codes, checksum tags, M117/M118 messages, macro names and parameters, parameter letters (X, Y, Z, E, F, S), and comments |
| **Log files** (`.log`) | Log-level colorization (debug, info, warning, error, critical), timestamps, URLs, UUIDs, git SHAs, exception names, and stack traces |
| **JSON** | Full validation and IntelliSense via a dedicated language worker |
| **CSS, SCSS, Less** | Property completion, hover, and validation via a dedicated language worker |
| **Markdown** | Basic syntax highlighting |

## Documentation links

When editing Klipper or Moonraker config files, clickable **CodeLens** links appear above each `[section]` header — linking directly to the relevant documentation page for:

- [Klipper](<https://www.klipper3d.org/Config_Reference.html>)
- [Kalico](<https://docs.kalico.gg/Config_Reference.html>)
- [Danger Klipper](<https://dangerklipper.io/Config_Reference.html>)
- [Moonraker](<https://moonraker.readthedocs.io/en/latest/configuration/>)
- [crowsnest](<https://crowsnest.mainsail.xyz/>)
- [moonraker-telegram-bot](<https://github.com/nlef/moonraker-telegram-bot/wiki>)

The correct documentation source is detected automatically based on the file being edited. This feature can be disabled in the editor settings.

## Outline and navigation

Klipper and Moonraker config files provide a two-level document outline:

- **Sections** — each `[section_name]` block
- **Properties** — each `key: value` or `key = value` within a section

Use <kbd class="key-control">Ctrl</kbd>\+<kbd class="key-shift">Shift</kbd>\+<kbd class="key-o">O</kbd> (or <kbd class="key-command">Cmd</kbd>\+<kbd class="key-shift">Shift</kbd>\+<kbd class="key-o">O</kbd> on macOS) to jump to any section or property, or browse the outline panel.

## Code folding

Collapsible regions are supported for Klipper config, Moonraker config, and G-code files.

**Klipper and Moonraker config:**

- Section blocks — collapse an entire `[section]` and its contents
- Comment blocks — consecutive comment lines fold together
- Named regions — `#region` / `#endregion` markers for custom foldable areas

**Klipper config only:**

- SAVE\_CONFIG blocks — the auto-generated `#*# ...` section folds as a unit

**G-code:**

- Print layers — each `SET_PRINT_STATS_INFO ... CURRENT_LAYER=N` starts a foldable layer block
- Exclude objects — `EXCLUDE_OBJECT_START` / `EXCLUDE_OBJECT_END` pairs
- Thumbnail blocks — `; thumbnail begin` / `; thumbnail end` comment sections
- Comment blocks — consecutive `;` comment lines fold together

## Keyboard shortcuts

| Action | Shortcut |
| --- | --- |
| Save | <kbd class="key-control">Ctrl</kbd>\+<kbd class="key-s">S</kbd> / <kbd class="key-command">Cmd</kbd>\+<kbd class="key-s">S</kbd> |
| Save As | <kbd class="key-control">Ctrl</kbd>\+<kbd class="key-shift">Shift</kbd>\+<kbd class="key-s">S</kbd> / <kbd class="key-command">Cmd</kbd>\+<kbd class="key-shift">Shift</kbd>\+<kbd class="key-s">S</kbd> |
| Save and Restart | <kbd class="key-control">Ctrl</kbd>\+<kbd class="key-alt">Alt</kbd>\+<kbd class="key-s">S</kbd> / <kbd class="key-command">Cmd</kbd>\+<kbd class="key-alt">Alt</kbd>\+<kbd class="key-s">S</kbd> |
| Emergency Stop | <kbd class="key-control">Ctrl</kbd>\+<kbd class="key-shift">Shift</kbd>\+<kbd class="key-e">E</kbd> / <kbd class="key-command">Cmd</kbd>\+<kbd class="key-shift">Shift</kbd>\+<kbd class="key-e">E</kbd> |
| Go to Line | <kbd class="key-control">Ctrl</kbd>\+<kbd class="key-g">G</kbd> |
| Go to Symbol | <kbd class="key-control">Ctrl</kbd>\+<kbd class="key-shift">Shift</kbd>\+<kbd class="key-o">O</kbd> / <kbd class="key-command">Cmd</kbd>\+<kbd class="key-shift">Shift</kbd>\+<kbd class="key-o">O</kbd> |
| Command Palette | <kbd class="key-f1">F1</kbd> |

All actions are also accessible from the Command Palette. For application-wide shortcuts and navigation hotkeys, see [Keyboard Shortcuts](<https://docs.fluidd.xyz/features/keyboard-shortcuts/index.md>).

## View state persistence

The editor remembers your scroll position, cursor location, and folding state for each file. This can be configured in the editor settings:

- **Local storage** — persists across browser restarts
- **Session storage** — persists within the current browser session
- **Off** — no persistence
