Skip to content

About

A lightweight IDE with a Rust core, a hand-written canvas renderer and no Electron.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Berlin IDE

A lightweight IDE with a Rust core, a hand-written canvas renderer, and no Electron anywhere in the stack.

Berlin IDE is built around a single architectural rule: the text lives only in Rust. The buffer is a rope in the core process; the UI never receives more than the ~60 lines you can actually see, and it receives them as a compact binary frame. That one decision is what keeps a 100 MB file as responsive as an empty one.

Three budgets every change is measured against:

Target Measured
Cold start to first keystroke < 300 ms tracked in CI
Empty editor, resident memory < 100 MB tracked in CI
Keystroke to pixel (p99) < 8 ms 0.14 ms p50 render

Anything that breaks one of those three doesn't go in, however nice the feature is.

The editor with the file explorer


Why this exists

Most "fast, lightweight" editors are a Chromium runtime with a text widget on top. Berlin IDE isn't:

  • No Electron. Tauri 2 uses the operating system's own WebView. The shipped binary is around 12 MB instead of ~180 MB, and the process starts near 60 MB resident instead of ~250 MB.
  • No Monaco, no CodeMirror. Both are good editors, but both own the buffer. Put the buffer in the JS heap and you pay for it twice — once in Rust for search and language servers, once in JS for rendering — and the IPC boundary becomes the bottleneck. Berlin IDE renders to a <canvas> from a glyph atlas it builds itself.
  • No UI framework. No React, no Vue. Roughly fifteen web components and a ~2 kB signal system. A reconciler between the keystroke and the pixel is a cost with no return here.
  • Not a VS Code fork, and deliberately not compatible with the VS Code extension API. That API drags Electron's architecture along with it, and chasing a moving target owned by someone else is not a foundation.

On the Microsoft question, precisely: there is no VS Code, Electron, Monaco, or Microsoft-owned runtime in this project. Two things do trace back to Microsoft and are worth naming rather than hiding: the UI is written in TypeScript (Apache-2.0, and the compiler only runs at build time — nothing of it ships), and language support speaks the Language Server Protocol (an open specification with implementations from everyone). Neither pulls in a VS Code dependency. If avoiding those two is the goal too, the TypeScript is compiled away and the LSP client is one crate.


What works today

The core, the editor, and the workbench are complete and in daily use. The list below is what's actually implemented, not what's planned.

  • Editor — rope buffer, multi-cursor, selections, and an undo tree rather than an undo stack, so a redo branch is never lost. Full IME support (CJK composition, dead keys), grapheme-cluster cursor movement, double-width characters, correct handling of files up to and past 100 MB.
  • File explorer with tabs and recursively splittable panes. Two splits on one file share a single buffer.
  • Syntax highlighting via Tree-sitter, with grammars loaded at runtime rather than compiled in — 15 languages shipped (Rust, TypeScript, TSX, JavaScript, JSON, TOML, Python, Markdown, HTML, CSS, YAML, Bash, Go, C, and Markdown-inline). Injections work: CSS inside <style>, code fences inside Markdown.
  • Terminal — a real PTY running your login shell, with the VT parser in Rust. The frontend receives cell grids, drawn by the same canvas renderer as the editor.
  • Search and replace — in the file (⌘F / ⌥⌘F) and across the project (⇧⌘F), the latter built on the crates behind ripgrep, respecting .gitignore, with results streaming in as they're found rather than after the run completes. Replacing across the project has a preview: every occurrence shown before and after, each one individually deselectable, and the whole run undone in a single step.
  • Git — status, branches, history, diff, and blame read through gitoxide; anything that writes shells out to the installed git so your credential helper, SSH agent, and hooks all keep working. Gutter markers, a source control panel, staging, commit, push/pull/fetch, stash, and revert. Clicking a file in the panel opens a side-by-side or inline diff against HEAD, with word-level highlighting inside changed lines.
  • Command palette (⇧⌘P), quick file open (⌘P), and a keymap system where every binding is a command with a context expression.
  • Themes and settings in TOML, live-reloaded, with contrast validation. Colours are defined in exactly one place.
  • Native menu bar and context menus, plus a file watcher that picks up changes made outside the editor.

Not there yet: language server integration (autocomplete, go-to-definition, rename) is designed but not built; SSH/remote, the plugin runtime, and a debugger come later. See docs/ARCHITECTURE.md §15 for the roadmap.

Platform: macOS is the primary target and where the app is built and used. It compiles and runs on Linux with WebKitGTK. Windows is not yet ported.

Language: the user interface is currently German only. Localisation hasn't been built yet — everything in the screenshots below is the real UI. If you want to help change that, see Contributing.

Project-wide search and replace

The command palette

The integrated terminal

The screenshots are captured from the UI running against the built-in mock backend — the JavaScript reimplementation of the IPC protocol used for browser-based testing — which is why the status bar reads Mock-Backend. Running against the Rust core it reads Rust-Core and the rest looks the same.


Installation

Prerequisites

Rust stable, 1.85 or newer — curl https://sh.rustup.rs -sSf | sh
Node 20 or newer
git optional, but needed for commit/push/pull (reading works without it)
macOS Xcode command line tools — xcode-select --install
Linux libwebkit2gtk-4.1-dev and libgtk-3-dev

A C compiler is also needed, to build the Tree-sitter grammars.

Build and run

git clone https://github.com/<your-account>/Berlin-IDE.git
cd Berlin-IDE
./berlin

That's the whole thing. ./berlin checks what's missing, fetches the syntax grammars, builds the application, and opens it. The first run takes ten to twenty minutes — the Tauri CLI, three hundred Rust dependencies in release profile, fifteen grammars. After that it takes about forty milliseconds to decide nothing has changed.

If something is missing from your system, the error names the command that fixes it. If only the network is missing, Berlin IDE still starts — just without syntax colours.

./berlin --hilfe          # all the flags
./berlin --dev            # development build with reload
./berlin --neu            # force a rebuild
./berlin --grammatiken    # (re)install the Tree-sitter grammars
./berlin --pruefen        # run the full check suite

On macOS you can also double-click Berlin IDE starten.command in Finder.

Syntax grammars

Grammars are loaded at runtime from ~/.berlin-ide/grammars, not compiled into the binary — otherwise every language would add 1–3 MB to the executable whether you open that language or not.

bash scripts/grammatiken-installieren.sh           # all fifteen
bash scripts/grammatiken-installieren.sh rust ts   # just some

Which languages ship, and which file extensions they claim, is in assets/grammatiken.toml; the exact revision each was built from is pinned in assets/grammatiken.lock.

A grammar can be built, copied into place, and still be useless — wrong ABI, missing highlights.scm, wrong extension in the manifest — and the editor says nothing about it, it just doesn't colour anything. So the install ends with a check that loads every grammar the way the app does and counts coloured spans rather than files:

cargo run -p kite-syntax --example grammatiken-pruefen

No restart is needed after installing: "Grammatiken neu einlesen" from the command palette rebinds already-open files too.

Trying the UI without building the app

The entire frontend runs in a browser against a JavaScript implementation of the same IPC protocol:

cd ui && npm install && npm run dev     # http://localhost:8000

Useful for UI work, but note the mock fakes syntax colours with a handful of regular expressions. Colour under npm run dev does not prove the application highlights correctly. The status bar tells you which backend you're on.


Tests

cargo test                                          # 463 core tests
cargo run --release -p kite-text --example budget   # core performance budgets

cd ui
npm install
npm test          # 188 frontend tests: input, IME, explorer, tabs, splits, …
npm run test:flaeche  # 16 more: shapes and motion on the canvas
npm run bench     # renderer performance budgets
npm run typecheck

Or all of it, including clippy and the benchmarks, in one call:

bash scripts/pruefen.sh          # ~4 minutes
bash scripts/pruefen.sh --kurz   # ~1 minute, skips release builds

On macOS there's one more run that matters, because the app ships in WKWebView and not in Chromium — Chromium has more headroom in several places, so it is the optimistic measurement, not the binding one:

cd ui && npx playwright install webkit
npm run test:webkit
npm run bench:webkit

There are also 253 contract-test steps that drive the Rust core and the JavaScript mock through the same script and assert they answer identically. Every new IPC command has to go into both implementations, or the test fails.


How it's put together

crates/
  kite-text/       rope, selections, transactions, undo tree, binary frame format
  kite-session/    documents, views, tabs, splits, cursor movement
  kite-workspace/  project tree, ignore rules, safe read and write
  kite-syntax/     Tree-sitter, grammar loader, queries, injections
  kite-search/     ripgrep integration, fuzzy matching, replace
  kite-terminal/   PTY, VT parser, cell grid
  kite-vcs/        gitoxide for reading, `git` for writing
  kite-config/     TOML cascade, schema, themes, keymaps
  kite-lsp/        language server client pool
  kite-app/        Tauri shell — thin, and outside the cargo workspace on purpose
ui/
  src/core/        frame encoder/decoder, IPC, mock backend
  src/editor/      glyph atlas, canvas renderer, input and IME
  src/panels/      explorer, tab bar, search, git
  src/overlays/    command palette, in-file find bar
  src/theme/       theme runtime
themes/            colour definitions — the only place colours live
docs/              architecture, measurements, progress notes

kite-app sits outside the cargo workspace deliberately: Tauri needs platform GUI libraries, and if it were inside, cargo test would fail on any machine without a display. This way the full test suite runs anywhere, including CI.

The crate names and CSS prefixes are still kite-*. The project was called Kite until July 2026; renaming internals would cost a full verification run and buy users nothing.

Everything else — the reasoning behind each decision, the performance budgets, the roadmap, and the risks — is in docs/ARCHITECTURE.md.


Contributing

Issues and pull requests are welcome. Two things to know before you open one:

  1. The IPC rule is not negotiable. Only deltas and viewports cross the boundary, never whole documents. A command that returns file contents as JSON puts the text in memory twice and takes the application down on a large file.
  2. A new IPC command goes into both backends — the Rust core and the JavaScript mock — and into tests/vertrag/ablauf.json. The contract test enforces this.

Run bash scripts/pruefen.sh before submitting. A change that breaks a performance budget doesn't get merged; that's how the performance survives a hundred small commits.

Much of the documentation and all of the UI strings are in German. English translations, and the localisation infrastructure to make them possible, are genuinely useful contributions.


License

Apache License 2.0 — see LICENSE.

About

A lightweight IDE with a Rust core, a hand-written canvas renderer and no Electron.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages