How We Rebuilt Settings in Zed
Zed's new Settings Editor required replacing its distributed, runtime-registered settings model, where each crate declared its own settings, with centralized strongly typed `UserSettings` and `ProjectSettings` structures that map directly to configuration files. A first attempt using macros to attach UI metadata became tangled in the crate graph's split between pre-UI and UI regions. Changes made under the old architecture also accidentally broke auto-update. Treating the settings files as the organizing principle led to a separate window rather than a workspace tab. On the UI side, GPUI gained tab groups that scope tab indices locally for automatic keyboard navigation, plus a `use_state`-style API for keeping ephemeral component state in the UI tree, which went through some memory-leak and scoping bugs before stabilizing.
Related posts
- Zed Weekly: #25
Zed mediumAdeptZed is rewriting its UI framework as GPUI 2 and porting the whole editor onto it before open-sourcing, trading feature work for better ergonomics while keeping GPUI 1's performance. All state lives in an AppContext that acts like an application-specific heap: Model<T> handles are dereferenced through a context, and models emit and subscribe to events. View<T> wraps models whose types implement a Render trait that returns element trees. Components, Tailwind-style styling helpers, a color-scale-based theme system and a new layout engine and executor round out the design. Bottleneck crates (project, workspace, editor) made the port largely serial, so the team leaned on Rust's type system and Zed's collaborative editing to pair on it, with roughly a third to half of the app ported after two weeks.
- Zed Weekly: #28
Zed mediumAdeptZed is rewriting its editor as Zed2 in three phases (runnable core editing, productivity features like collaboration, terminal and Vim mode, then flagship features like Assistant, Copilot and Chat), aiming for a preview by end of 2023 and open-sourcing shortly after Zed2 supersedes Zed1. Team updates cover porting core UI such as popovers, autocomplete menus and breadcrumbs. The UI component work introduces a shared `ButtonLike` base for `Button` and `IconButton` and Rust traits like `Selectable` that concrete components delegate to, keeping APIs and styling consistent. Other updates include typescript-language-server, eslint and prettier fixes, plus an idea for searching gitignored directories in the file finder.
- Why the big rewrite?
Zed easyNoviceZed rewrote its Rust UI framework from GPUI 1 to GPUI 2 because the original design blocked fast UI work: a Flutter-style constraints-down/sizes-up layout model, styles split between Rust element code and TypeScript-generated JSON "themes" loaded at runtime, model code entangled with presentation (a legacy of an early Electron/JSON architecture), and weakly typed geometry (raw f32s and usizes). GPUI 2 adopts a Tailwind/Flexbox-inspired Rust DSL with stronger types and one-directional ownership. The migration ran incrementally: GPUI 2 first ran as a prototype on top of GPUI 1, then crates were duplicated (e.g. project_panel2) with the old copies frozen except for bug fixes, which kept the option of sharing code until the final switch.
- Zed Weekly: #23
Zed mediumAdeptZed's weekly team update covers a fix for typing lag with autocomplete. Completion re-filtering was offloaded to background workers, but a higher-level callsite blocked the UI thread waiting on that future, so the re-filter now runs without blocking and races the re-request to the language server. Other items: UI components migrated to the latest GPUI with stories now living beside each component, GPUI 2's stateless element model requiring IDs on stateful elements such as click handlers, prettier and Vue.js integration in the next preview, Universal Links, channel permissions and a notifications panel.
- Zed Weekly: #27
Zed mediumAdeptGPUI, Zed's UI framework, settled on its core view traits: `Render` builds a view from a mutable reference each frame, `RenderOnce` builds composable elements by consuming them, and `#[derive(IntoElement)]` lets custom components be passed straight to `div().child(...)`. gpui2 now sizes UI in `rem` units tied to a new `ui_font_size` setting (default 16px, on a 4px grid), so the interface scales independently of buffer font size, though sub-pixel sizes remain unresolved. On the worktree side, a `file_scan_exclusions` setting now hides files like `.DS_Store`, and project search can reach gitignored files. Extending the fuzzy file finder to gitignored trees is still open, because eagerly scanning and watching huge `node_modules` or `target` directories is costly.