preview tabs: Allow replacing preview tab when using code navigation (#10730)

This PR adds support for replacing the current preview tab when using
GoToDefinition. Previously a tab, that was navigated away from, was
converted into a permanent tab and the new tab was opened as preview.

Without `enable_preview_from_code_navigation`:


https://github.com/zed-industries/zed/assets/53836821/99840724-d6ff-4738-a9c4-ee71a0001634

With `enable_preview_from_code_navigation`:


https://github.com/zed-industries/zed/assets/53836821/8c60efcb-d597-40bf-b08b-13faf5a289b6

Note: In the future I would like to improve support for the navigation
history, because right now tabs that are not "normal" project items,
e.g. FindAllReferences cannot be reopened

Release Notes:

- Added support for replacing the current preview tab when using code
navigation (`enable_preview_from_code_navigation`)
This commit is contained in:
Bennet Bo Fenner
2024-04-29 20:47:01 +02:00
committed by GitHub
parent 9ff847753e
commit 20625e98ad
19 changed files with 120 additions and 60 deletions
+12 -1
View File
@@ -809,7 +809,8 @@ These values take in the same options as the root-level settings with the same n
```json
"preview_tabs": {
"enabled": true,
"enable_preview_from_file_finder": false
"enable_preview_from_file_finder": false,
"enable_preview_from_code_navigation": false,
}
```
@@ -823,6 +824,16 @@ These values take in the same options as the root-level settings with the same n
`boolean` values
### Enable preview from code navigation
- Description: Determines whether a preview tab gets replaced when code navigation is used to navigate away from the tab (requires Zed `0.134.x`).
- Setting: `enable_preview_from_code_navigation`
- Default: `false`
**Options**
`boolean` values
## Preferred Line Length
- Description: The column at which to soft-wrap lines, for buffers where soft-wrap is enabled.