Nathan Sobo talks about building Zed, a text editor in Rust, focusing on UI design, performance optimization, and collaboration features. He discusses challenges in editor development, using Rust for Zed, high frame rate rendering, WebAssembly, and testing concurrent networking code. The podcast explores innovative features like TreeSitter, Language Server Protocol, and future visions for Zed, including open-sourcing components and CRDB integration.
Zed editor leverages Rust for performance and aesthetics.
Z utilizes Segment Trees for efficient text transformations.
Z prioritizes real-time collaboration with CRDTs for effective teamwork.
Deep dives
Building a New Text Editor: Z with Nathan Sobow
Nathan Sobow, a developer behind the Atom text editor, has embarked on creating a new editor called Z. Atom faced challenges after GitHub's acquisition by Microsoft, leading to its decline. With Z, Nathan aims to leverage his Atom experiences to design a faster and more visually appealing editor using the Rust language. The choice of language is crucial, as Rust prioritizes performance while maintaining aesthetics.
Architecting Editor: Data Structure in Focus
A critical aspect in editor design is mastering data structures like the Segment Tree, essential for indexing and storing text efficiently. Z employs Segment Trees for aggregating data in the text editor, enabling faster sequencing of text transformations like folding, soft wraps, and tab expansions. This persistent data structure enhances Z's editing capabilities, supporting complex transformations seamlessly.
Enhancing Real-Time Collaboration with CRDTs
Z prioritizes real-time collaboration through Conflict-free Replicated Data Types (CRDTs) for concurrent editing. By ensuring eventual data consistency among users, Z facilitates effective pair programming, code reviews, and real-time editing interactions. The innovative integration of CRDTs enhances coordination among developers, providing a seamless, cooperative editing environment for productive teamwork in code development.
Collaborative Editing and Anchors in Text Fragments
The podcast delves into the concept of collaborative editing by discussing the use of anchors in text fragments to facilitate seamless collaboration. Anchors are unique identifiers assigned to fragments, allowing precise location tracking even if the text gets fragmented during editing. The implementation of anchors enables efficient demarcation of text regions, providing a versatile tool for editing within specific text segments.
TreeSitter and Language Server Protocol for Extensibility
The episode explores the significance of TreeSitter, an incremental parser generator, and the Language Server Protocol in enhancing extensibility. TreeSitter offers efficient parsing of text with error recovery, vital for effective editor functionality. Additionally, the Language Server Protocol, popularized by Microsoft, standardizes interactions between editors and programming languages, fostering broad language support and extensibility capabilities within the editor framework.
I’ve often wondered how you build a text editor. Like many software projects, it’s a simple idea at the core with an almost infinite scope for features. How do you build a solid foundation to expand on? Which features matter for launch? And how do you hope to satisfy the needs of every programmer, working in every language?
My guest for this episode is Nathan Sobo. He’s tackled this problem once before with the Atom editor, and he’s back older & wiser with Zed - a new editor written completely from scratch in Rust. It has a modern UI, a wide spread of language support, and a completely different way of looking at team collaboration. But with so much ambition, what are Zed’s priorities, and what’s been left for a future version?