# Add debug methods for visually annotating ranges \(\#38097\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/e43ad858d80660460531477c07a5dd1c0f4d5c67)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: e43ad858d80660460531477c07a5dd1c0f4d5c67

Requested commit: e43ad858d80660460531477c07a5dd1c0f4d5c67

Commit: e43ad858d80660460531477c07a5dd1c0f4d5c67

Tree: d8483bae9036319d2aafebaf97107acdd243247a

Author: Michael Sloan

Committer: GitHub

## Message

```
Add debug methods for visually annotating ranges  (#38097)

This allows you to write `buffer_snapshot.debug(ranges, value)` and it
will be displayed in the buffer (or multibuffer!) until that callsite
runs again. `ranges` can be any position (`usize`, `Anchor`, etc), any
range, or a slice or vec of those. `value` just needs a `Debug` impl.
These are stored in a mutable global for convenience, and this is only
available in debug builds.

For example, using this to visualize the captures of the brackets
Tree-sitter query:

<img width="1215" height="480" alt="image"
src="https://github.com/user-attachments/assets/c1878fc7-f6b3-4e27-949e-ecf67a7906b9"
/>

Release Notes:

- N/A
```

## Parents

- [ded646760467d653fd57ee3ef4fc1edcfafba6ae](https://git.cafe/gitcafe/zed/commit/ded646760467d653fd57ee3ef4fc1edcfafba6ae?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/e43ad858d80660460531477c07a5dd1c0f4d5c67?format=markdown)
