# project_symbols: Add preview to project symbols picker \(\#59863\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 9448417157a9e690d87213c89ea9913803373b4f

Requested commit: 9448417157a9e690d87213c89ea9913803373b4f

Commit: 9448417157a9e690d87213c89ea9913803373b4f

Tree: 8f8d058d553b56fa437f180a9012d27e4492f5c3

Author: august

Committer: GitHub

## Message

```
project_symbols: Add preview to project symbols picker (#59863)

Candidate fix for #59822.

Adds a live preview pane to the project symbols picker, matching the
file finder and project search pickers. When the selection moves, the
selected symbol's file is shown in the preview with its declaration line
highlighted and vertically centered.

## Changes
- `project_symbols`: construct the picker with
`uniform_list_with_preview`; asynchronously open the buffer for the
selected symbol (cached by candidate id, cleared on each new query) and
implement `try_get_preview_data_for_match` to return the buffer plus the
symbol's anchor range.
- `picker`: add a public `refresh_preview` so a delegate can push
preview data once a buffer finishes opening asynchronously (the symbol
buffer is not available synchronously, unlike text search which already
holds open buffers).


#### Before
<img width="1725" height="712" alt="image"
src="https://github.com/user-attachments/assets/21dcd7d6-7cc4-4de8-ab7d-2f1ce143e814"
/>

##### After
<img width="1725" height="712" alt="image"
src="https://github.com/user-attachments/assets/db981db8-0a61-43bc-9838-c01b7bdbbf78"
/>

Can turn preview pane off by clicking at the bottom button!

## AI disclosure
AI was used for understanding the codebase and formatting this PR.

Release Notes:

- Added a preview pane to the project symbols picker

---------

Co-authored-by: Yara <git@yara.blue>
```

## Parents

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

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