zed/crates/project_panel
Vlad Roskov a3a4719a8a
project_panel: Open files in a permanent tab on middle click (#60563)
# Objective

Provide a means of quickly opening a permanent tab from project panel
instead of a preview tab.

Implements #51866 (_Middle click to open file in a new tab_ with 18×↑)
which is also part of #31822 (_Middle Click Improvments_) titled "middle
clicking on a file in the project panel should open the file in a
non-transient state".

With `preview_tabs.enable_preview_from_project_panel` enabled, a click
in the project panel opens a preview tab, and there's no easy gesture to
open a permanent one instead, simplest one currently being a double
click. VS Code and VSCode-based editors recognize middle mouse click as
a way to open a permanent tab since 2016 (microsoft/vscode#14453).

## Solution

Wired up an `on_aux_click` handler for project panel entries:
middle-clicking a file opens it in a permanent tab and focuses it,
regardless of the preview tabs setting.

Added a line to `docs/src/project-panel.md` to reflect the behavior.

## Testing

- Manually tested on Windows: middle click opens a permanent tab,
promotes an existing preview tab to a permanent one if already open,
does nothing for directories
- Haven't tested on macOS/Linux

## Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

<details>
  <summary>Click to view showcase</summary>


https://github.com/user-attachments/assets/2de5f23d-637f-4ffc-8d03-02dc11714af4

</details>

---

Release Notes:

- Added support for middle-clicking a file in the project panel to open
it in a permanent tab instead of a preview tab
2026-07-08 13:06:10 +00:00
..
benches project_panel: Add sort_order settings (#50221) 2026-04-08 18:33:00 +05:30
src project_panel: Open files in a permanent tab on middle click (#60563) 2026-07-08 13:06:10 +00:00
Cargo.toml project_panel: Continue batch delete when individual entries fail (#59595) 2026-07-02 16:04:53 +00:00
LICENSE-GPL