# Objective - Implement a folder context menu in the git panel tree view. - Fixes #56020 - Initially I wanted to only fix this, but realized that there is no right-click action on folders at all and previously right-clicking a folder had the same effect as clicking in the panel at an empty place. So I implemented some more, but tried to keep it simple for now. ## Solution Refactored the `git_ui::git_panel::GitPanel::deploy_entry_context_menu` in order for it to also work with directories, ensuring that some options ("Open Diff"/"Open File Diff"/"View File"/"View File History") are filtered out when opened for a directory. In order to simplify this and make it clear whether the context menu was deployed for a directory, a file or a selection of multiple entries, the `git_ui::git_panel::SelectionTargetKind` enum was introduced. Some other changes not directly related to this functionality but worth calling out: - Fixed the file count in the context menu being incorrect when the same `RepoPath` appeared in both the "Staged" and "Unstaged" sections, by deduplicating entries by `RepoPath` in `GitPanel::effective_status_entries`, so a partially staged file is only counted, and acted on, once. The same method now also expands a selected directory into its descendant files. - Updated `GitPanel::revert_entries` so that discarding multiple untracked files moves them to the trash instead of deleting them, consistent with the single-file behaviour. `GitPanel::revert_entry` was removed, so all discards now go through this method. - Added `GitPanel::should_unstage`, which decides whether toggling should stage or unstage the target, taking into account the section the action was triggered from when grouping by staging status. Previously, bulk toggling staged the entries unless all of them were already fully staged, regardless of section. ## Testing Test both on Linux and macOS, manually, as well as added the following tests: - `git_ui::git_panel::tests::test_add_to_gitignore` - `git_ui::git_panel::tests::test_add_to_git_info_exclude` - `git_ui::git_panel::tests::test_revert_directory_trashes_untracked_files` - `git_ui::git_panel::tests::test_bulk_toggle_staged_respects_staged_section_intent` ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [ ] 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) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Showcase <img width="2604" height="1938" alt="CleanShot 2026-09-25 at 15 14 40@2x" src="https://github.com/user-attachments/assets/c44fafde-b28d-4e1e-a07a-e72ae90af1f1" /> --- Release Notes: - Added a folder-specific context menu in the Git Panel's tree view --------- Co-authored-by: dino <dinojoaocosta@gmail.com>
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).
Other platforms are not yet available:
- Web (tracking discussion)
Developing Zed
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
Zed source code is licensed primarily under GPL-3.0-or-later, with Apache-2.0 components where marked.
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Sponsorship
Zed is developed by Zed Industries, Inc., a for-profit company.
If you’d like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.