Zed code editor introduces rainbow brackets, a highly-requested feature that colors nested brackets at different levels for improved code readability. The implementation uses a chunk-based approach with tree-sitter queries rather than maintaining full syntax trees in memory. Brackets are colored in 50-row chunks that invalidate on buffer changes but only re-query when visible, avoiding the complexity of global state management. The feature is opt-in per language, reuses theme accent colors, and includes performance optimizations to tree-sitter's query execution.

7m read timeFrom zed.dev
Post cover image
Table of contents
How we built itPutting it togetherTry it todayWhat's nextBuilding a platform that open sources itselfThe Debugger is HereNative Git support in Zed
8 Comments

Sort: