Editor features
The Custom G-code Editor uses Monaco (the same engine behind VS Code) with a purpose-built G-code language definition. Every feature is tuned for working with printer instructions — not generic code.
Syntax highlighting
G-code commands are colored by function so you can scan a file at a glance. Each token type maps to a dedicated color that follows your app theme:
| Token | Examples | Purpose |
|---|---|---|
| Motion | G0, G1, G2, G3 | Movement commands (blue) |
| Position | X100.5, Y50.2, Z0.3 | Coordinate parameters (teal) |
| Extrusion | E1.234 | Filament extrusion (green) |
| Feedrate | F1200 | Speed parameter (orange) |
| Temperature | M104, M109, M140, M190 | Thermal commands (red) |
| Fan/cooling | M106, M107 | Cooling commands (light blue) |
| Control flow | M0, M1, M600 | Pauses and filament changes (yellow) |
| Homing | G28, G29, G80 | Homing and leveling (purple) |
| Retraction | G10, G11 | Firmware retraction (salmon) |
| Comments | ; this is a comment | Inline comments (dim green) |
| Unknown | Unrecognized commands | Underlined (amber) |
| Values | 10.5, -3.2, 255 | Numeric literals (light green) |
| Line numbers | N100 | N-prefix line numbering (gray) |
A typical highlighted line looks like this:
G1 X120.500 Y80.200 Z0.300 E1.5432 F1200 ; perimeter move
Where G1 is blue, X120.500 Y80.200 Z0.300 is teal, E1.5432 is green, F1200 is orange, and ; perimeter move is dim green.
Autocomplete
Type a G or M to see suggestions for 30+ recognized commands. Each suggestion includes:
- The command code (e.g.
G28) - A short description (e.g. "Home — Move to home position")
- Expected parameters (e.g.
X Y Z)
G --> G0 Rapid Move X Y Z F
G1 Linear Move X Y Z E F
G28 Home X Y Z
G29 Bed Leveling
M104 Set Hotend Temp S
M109 Wait Hotend Temp S R
...
Hover documentation
Hover over any recognized command to see a tooltip with:
- Command name and code
- What it does in plain English
- Parameters it accepts
For example, hovering over M109 shows:
M109 — Wait Hotend Temp
Set nozzle temperature and wait until reached.
Parameters: S(temp) R(temp)
Find and replace
The editor includes Monaco's full find-and-replace panel:
- Ctrl+F — open find
- Ctrl+H — open find and replace
- Regex mode — toggle regex matching for advanced searches
- Case sensitive — toggle case matching
- Whole word — toggle whole-word matching
This is useful for tasks like finding all M104 temperature commands or replacing a feedrate across the file.
Section-colored minimap
The minimap on the right edge of the editor displays colored bands that correspond to structural section types. Each section type gets a distinct translucent color overlay:
- Perimeter / outer wall — coral/red
- Infill — blue
- Travel — light green
- Support — olive
- Startup / shutdown — gray
- Skin / top-bottom — cyan
This gives you a birds-eye view of file structure without scrolling. The overview ruler (the thin bar to the right of the scrollbar) uses the same colors, so you can jump to a specific section type at a glance.
The colors automatically match the Line Type color mode in the 3D viewer and the dots in the Outline Panel.
Inline diagnostics
The editor shows squiggly underlines for potential G-code issues detected by the analysis engine. Warnings appear in real-time as you edit:
| Severity | Appearance | Examples |
|---|---|---|
| Error | Red underline | Motion before homing, Z collision risk |
| Warning | Yellow underline | Cold extrusion, flow limit exceeded, feedrate zero |
| Info | Blue underline | Fan enabled before 2nd layer |
Hover over a warning to see the full message and a suggested fix. The toolbar shows a badge with the total warning count.
Diagnostics include: missing homing (G28), cold extrusion, volumetric flow exceeding printer limits, Z collision risk, ineffective retractions, temperature not reached, extrusion mode mismatch, feedrate at zero, out-of-bounds moves, and early fan activation.
Structural folding
The editor automatically creates foldable regions based on the structural analysis:
- Startup section — everything before the first extrusion
- Layer sections — each Z-height change creates a foldable layer
- Shutdown section — everything after the last extrusion
Click the fold arrows in the gutter to collapse or expand sections. This makes navigating large files (100k+ lines) fast.
Bidirectional selection
The editor and 3D viewer stay in sync:
Editor to 3D: Select one or more lines in the editor. The corresponding toolpath segments light up in the 3D viewer, and the metrics panel shows stats for just the selection.
3D to editor: Click a toolpath segment in the viewer. The editor scrolls to the corresponding G-code line and highlights it.
This two-way link uses the same selectedGcodeLines pattern as the G-code Inspector panel, so it works consistently across the app.
Read-only mode
Toggle read-only mode from the toolbar to prevent accidental edits. When read-only is active:
- The editor shows a visual indicator
- Typing is disabled
- Find and navigation still work
- Selection and 3D highlighting still work
This is useful when reviewing slicer output or analyzing a file you don't want to modify.
Keyboard shortcuts
| Shortcut | Action |
|---|---|
Ctrl+F | Find |
Ctrl+H | Find and replace |
Ctrl+G | Go to line |
Ctrl+Z | Undo |
Ctrl+Shift+Z | Redo |
Ctrl+/ | Toggle comment |
Ctrl+Shift+[ | Fold region |
Ctrl+Shift+] | Unfold region |
All standard Monaco keyboard shortcuts are available.