Skip to content

SB0LTD/sbcode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

149,095 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SBCode

A fully-featured native code editor reimplemented in pure Zig. Single 5 MB binary, zero dependencies, zero heap allocations.

What is this?

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.

Quick Start

Requires Zig 0.15.2+.

# Build
zig build

# Run
./zig-out/bin/sbcode.exe

# Test
zig build test

Numbers

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

Architecture

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.

Features

  • 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

Testing

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 test

All tests run deterministically on every build.

System Libraries

opengl32, gdi32, user32, kernel32, winhttp, bcrypt. Nothing else.

Platform

Windows x86_64 only. That's the point.

Support the Research

This project is the result of extensive research by SB0 LTD. If you find it valuable, consider supporting our work:

Ko-fi

License

See LICENSE.txt.

Copyright (c) SB0 LTD. All rights reserved.

About

Visual Studio Code Fork by SB0 LTD

Resources

License

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 94.3%
  • CSS 1.6%
  • Zig 1.5%
  • JavaScript 0.9%
  • Rust 0.6%
  • HTML 0.4%
  • Other 0.7%