A fully-featured native code editor reimplemented in pure Zig. Single 5 MB binary, zero dependencies, zero heap allocations.
SBCode is a complete native reimplementation of Visual Studio Code targeting Win32 + OpenGL 1.x immediate-mode rendering. It replicates VS Code's core editing experience — multi-tab editing, syntax highlighting, command palette, file I/O, workbench layout, keybinding system, and full UI chrome — compiled to a single executable that links only system libraries.
The entire project was developed in a single 5-hour session, 100% AI-generated using our patent-pending Reciprocal Reflective Steering (RRS) methodology. See RESEARCH.md for the full paper.
Requires Zig 0.15.2+.
# Build
zig build
# Run
./zig-out/bin/sbcode.exe
# Test
zig build test| VS Code (Electron) | SBCode (Zig) | |
|---|---|---|
| Binary size | ~350 MB | 5 MB |
| Idle memory | ~300 MB | ~8 MB |
| Cold start | 3–5 seconds | <10 ms |
| Input latency | 30–100 ms | <2 ms |
| Dependencies | Chromium, Node.js, V8 | None |
| Heap allocations | Millions | 0 |
src/
├── base/ Ring buffer, fixed list, strings, event, rect, color, URI, JSON parser
├── editor/ Text buffer, cursor/selection, syntax highlighting, viewport, tabs
├── platform/ Win32 bindings, OpenGL bindings, file service, HTTP, input, keybinding, config
├── renderer/ Font atlas (GDI → OpenGL texture)
├── workbench/ Layout engine, command palette, activity bar, sidebar, panel, status bar
├── tests/ 17 property-based test suites + unit tests
├── app.zig Application lifecycle (window, GL context, main loop)
└── main.zig Entry point
Layered design: Base → Platform → Editor → Workbench → Application. No circular dependencies. All storage is stack or comptime-sized.
- Multi-tab text editing with open/close/switch
- Syntax highlighting for Zig, JSON, and plain text (VS Code dark theme colors)
- Multi-cursor support (up to 64 simultaneous cursors)
- Command palette with fuzzy subsequence matching and score-ranked results
- Keybinding system (Ctrl+O open, Ctrl+S save, Ctrl+P command palette)
- Full workbench layout: title bar, activity bar, sidebar, editor area, panel, status bar
- Custom borderless window with title bar drag
- File open/save via Win32 file dialogs
- Config loading with fallback defaults
- HTTP client via WinHTTP
- Status bar notifications for errors
- Editor viewport with scroll, cursor bar, and selection highlighting
48 source files, 12,405 lines of Zig. 4,194 lines are tests (33.8% coverage). 17 property-based test suites verify invariants across all layers using a custom comptime LCG pseudo-random generator (zero external dependencies).
zig build testAll tests run deterministically on every build.
opengl32, gdi32, user32, kernel32, winhttp, bcrypt. Nothing else.
Windows x86_64 only. That's the point.
This project is the result of extensive research by SB0 LTD. If you find it valuable, consider supporting our work:
See LICENSE.txt.
Copyright (c) SB0 LTD. All rights reserved.