Seven stages, each a tap away. Links open the full component breakdown.
Platform-specific code (Cocoa/X11/Win32) intercepts OS events and converts them into GPUI's unified event types, then hands them off to the application event loop.
App::dispatch_action() routes actions through the focused element tree in capture then bubble phases. The keymap translates keystroke sequences like ctrl-k into typed action structs like MoveToEndOfLine.
Workspace orchestrates panes, docks, and the project. The active Pane holds a stack of items; the focused item (usually an Editor) receives the action. Project owns buffer and LSP lifetimes.
Editor is the central editing component. handle_input processes typed text; action handlers update SelectionsCollection (cursors) and call MultiBuffer::edit() for text mutations. The DisplayMap tracks visual transforms.
Buffer wraps a CRDT TextBuffer and a tree-sitter SyntaxMap. Edits are applied transactionally; the syntax tree is invalidated and re-parsed on a background thread. MultiBuffer stitches multiple buffers into a single composite view with excerpt ranges and undo history.
After each buffer edit, LspStore sends a textDocument/didChange JSON-RPC notification to each registered LanguageServer process. The server replies asynchronously with diagnostics, which are stored back in the Buffer and trigger a re-render. Completions, hover, and go-to-definition follow the same request/response pattern.
cx.notify() schedules a redraw. GPUI calls each view's render(), building an element tree. EditorElement::paint() takes a DisplaySnapshot, converts lines to glyph positions, and emits quads/sprites into a Scene. The WGPU layer then batches these into draw calls submitted to Metal/Vulkan/DX12 and presents the framebuffer.