---
title: "Zed Has Rainbow Brackets"
description: "Zed implements rainbow brackets without language servers or a persistent syntax tree by running each language's tree-sitter brackets.scm queries over independent 50-row chunks and coloring pairs by nesting depth across 7 cycling theme accent colors."
url: "https://swe.quest/articles/zed-has-rainbow-brackets-56d1fa479c442850"
canonical: "https://zed.dev/blog/rainbow-brackets"
source: "Zed"
published: "2025-12-03"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 6
tags: ["developer-tools","rust","caching","performance","testing"]
---

# Zed Has Rainbow Brackets

A post on [Zed](https://swe.quest/sources/zed.md), published 2025-12-03, 6 min read, Deep dive. Original: [https://zed.dev/blog/rainbow-brackets](https://zed.dev/blog/rainbow-brackets)

## Summary

Zed implements rainbow brackets without language servers or a persistent syntax tree by running each language's tree-sitter brackets.scm queries over independent 50-row chunks and coloring pairs by nesting depth across 7 cycling theme accent colors. Chunks may occasionally be off by one color at boundaries, a tradeoff accepted to avoid maintaining global bracket state. Results are cached on the buffer rather than the ephemeral editor, versioned with clock::Global, invalidated eagerly on edits and re-queried lazily only for visible ranges. Upstream tree-sitter changes that limit query search ranges keep performance acceptable, and a visual test notation annotates each bracket with its color index.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)
- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [Caching](https://swe.quest/tags/caching.md) (Backend & APIs)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)

## Prerequisites

- tree-sitter queries
- text editor architecture ([easy posts on Developer tools](https://swe.quest/tags/developer-tools.md?difficulty=easy))

## Keywords

Zed, tree-sitter, rainbow brackets, LSP, VS Code

## Related posts

- [Enabling low-latency, syntax-aware editing using Tree-sitter](https://swe.quest/articles/enabling-low-latency-syntax-aware-editing-using-tree-sitter-9ffe8225d976568b.md): Zed · 2023-03-27 · Medium · 10 min read · Developer tools, Compilers, Data structures, Rust
  Zed builds its syntax-aware features on Tree-sitter, a GLR-based incremental parsing framework with error recovery that produces concrete syntax trees.
- [Zed Weekly: #17](https://swe.quest/articles/zed-weekly-17-390d0b1828377e87.md): Zed · 2023-08-22 · Easy · 7 min read · Developer tools, LLMs, Rust
  Weekly team update from the Zed editor team covering AI features, channels, language support and UI work.
- [Extensible Language Support in Zed - Part 1](https://swe.quest/articles/extensible-language-support-in-zed-part-1-13bc037c6f5096a9.md): Zed · 2024-04-18 · Medium · 7 min read · WebAssembly, Developer tools, Sandboxing & isolation, Compilers, Rust
  Zed loads third-party Tree-sitter grammars as WebAssembly modules using a hybrid design.
- [Zed Weekly: #18](https://swe.quest/articles/zed-weekly-18-7d443e4b9455171f.md): Zed · 2023-09-05 · Easy · 4 min read · Developer tools, AI for coding, RAG & retrieval
  Zed's semantic index now batches embedding requests by token count rather than span count, cutting OpenAI requests and improving throughput and consistency.
- [Zed Weekly: #21](https://swe.quest/articles/zed-weekly-21-6f0d0de0d9285330.md): Zed · 2023-09-29 · Easy · 7 min read · Developer tools, Frontend, Rust
  Weekly team update from the Zed editor team. It covers initial Prettier integration and better LSP server log display, a storybook CLI for rendering new GPUI UI components in isolation, and Vim mode's command palette shipping to preview.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
