mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-20 07:30:22 +01:00
d0400aaf033a703a037f8fe5400bbc896db985da
1001 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4fd48c02ac |
Miscellaneous improvements to prepare for Rust 1.100 (#66901)
## Summary Fixes rustc and clippy warnings for a potential upcoming Rust 1.100 version bump. All changes are backwards compatible and Rust is **not** bumped in this PR. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - N/A - [GPUI] N/A --------- Co-authored-by: Finn Evers <finn.evers@outlook.de> |
||
|
|
6ceb6fee87 |
git_ui: Fix "entity released" errors when closing the branch picker early (#66873)
The branch picker detached the tasks that wait for the default branch and remote URLs. If you closed the picker before they finished, they tried to update it anyway and logged `entity released`. The picker now owns those tasks, so they're dropped along with it. <img width="600" src="https://github.com/user-attachments/assets/2cff4aab-8476-4aa6-bd68-b1b3953fd163" /> Release Notes: - N/A |
||
|
|
1d8eda94bd |
gpui: Improve primitive batching (#66810)
GPUI groups primitives into GPU batches by draw order. Each primitive is inserted into an R-tree of the bounds painted so far, which assigns it a draw order one above the highest order it overlaps. The renderer then draws primitives in batches grouped by draw order, then by primitive kind. We fix two limitations that split batches unnecessarily: - Previously, a primitive that overlapped anything was assigned a new draw order. However, GPUs draw instances in submission order, and within a draw order we draw kinds in a fixed order. So, a primitive can share the draw order of an overlapping primitive, as long as its kind doesn't sort before the overlapped primitive's kind. (Sprites are exempted, since sprites are also sorted by their atlas texture within a draw order.) - Note that adjacent batches of the same kind were already merged on `main`, but any primitive of another kind drawn in between kept them apart. Now, we reuse the draw order whenever it's safe. - Previously, `window.paint_layer` created a new draw order from the provided bounds as soon as the layer was opened. Now, the layer is inserted into the R-tree once it's closed, using the union of the bounds of the primitives painted inside the layer. It reuses a draw order by the same rule, if every primitive in the layer could. - Since `paint_layer` now computes its bounds from the primitives it paints, the `bounds` argument is no longer needed and was removed. Despite this, scene construction is still faster than it is on `main`. In Zed, this cuts batches per frame from 20 to 4 at startup, and from 22 to 6 with a selection. On an Intel HD 4600, GPU time drops by 2.5–4.5%. Release Notes: - Reduced GPU usage - [GPUI] Improved draw call batching. `Window::paint_layer` no longer takes a `bounds` argument |
||
|
|
fdb60b8003 |
git_ui: Ensure check is right-aligned in repository selector (#66831)
## Summary Update how the check icon for the selected repository is rendered in `RepositorySelectorDeletage` in order for it to be right-aligned, just like we already do in other pickers – `ThemeSelector`, `IconThemeSelector`, `ModelSelector`, `LineEndingSelector`, etc. However, I'm not entirely sure whether it's always best for the checkmark to be right-aligned, as that might mean the user's eyes have to scan more in order to find the currently selected item. ## Testing Tested manually as shown in the screenshots below. ### Showcase <details> <summary>Before</summary> <img width="5312" height="3018" alt="CleanShot 2026-11-11 at 12 59 40@2x" src="https://github.com/user-attachments/assets/8baae0be-7cd4-4d46-aa34-a2ee74f9f639" /> </details> <details> <summary>After</summary> <img width="5312" height="2970" alt="CleanShot 2026-11-11 at 12 53 14@2x" src="https://github.com/user-attachments/assets/41ca7690-1221-4f0d-a097-71144635c906" /> </details> ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - N/A |
||
|
|
912159c7ad |
git_ui: Disambiguate repository names in the repository selector (#62800)
The repository selector and the Git panel footer both label a repository with the leaf name of its working directory. In a workspace where every project is checked out into a directory of the same name, every row reads the same. Related to #56255 (discussion) and #56265, which proposed always prepending the parent directory. The review there raised that this adds noise where the leaf name is already unique, example `Developer/foo` and `Developer/bar` gain nothing from it. This PR takes a different approach suggested in that thread. ## Solution Add `disambiguated_display_names`, which labels each repository with its leaf directory name where that is already unique across the workspace, and grows only the colliding labels by one parent component at a time until they are distinct. Repositories whose names never collide are unchanged. ## Testing - `cargo test -p project --lib git_store::tests::test_disambiguated_display_names` — passed. Covers unique leaves being left alone, single-parent disambiguation, the multi-parent case, identical paths, and empty input. - `./script/clippy` — passed. - `cargo fmt --check -p project -p git_ui` — passed. - `cargo build` — passed. - Manually tested on macOS with a debug build, on a workspace of 12 repositories: a meta-repository, five submodules checked out as `src`, two nested `proto`, two nested `protos`, and two uniquely named ones. Reviewers can reproduce it with any tree that nests several repositories into same-named directories. Not tested on Linux or Windows. ## Self-Review Checklist: - [x] 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) - [x] Tests cover the new/changed behavior - [ ] Performance impact has been considered and is acceptable ## Showcase I created a stub project and build and ran the development build, replicating my project structure that I used where I did ran into the "issue". This is a before and after comparison. <img width="965" height="863" alt="before-and-after" src="https://github.com/user-attachments/assets/8775c643-f3ee-41ac-a2b3-fba991990a8e" /> --- Release Notes: - Improved the Git Panel’s repository selector to distinguish repositories that share the same directory name. --------- Co-authored-by: Josia Aranda <josiaranda@users.noreply.github.com> Co-authored-by: dino <dinojoaocosta@gmail.com> |
||
|
|
0d1756eb10 |
git_ui: Normalize git branch name when renaming (#65734)
## Summary Normalize git branch name in action `git::RenameBranch` to make its behavior similar to action `git::Branch`. ### Before <img width="1237" height="169" alt="image" src="https://github.com/user-attachments/assets/dedc1e6a-5573-4202-b7f3-e6c4744fb000" /> <img width="768" height="481" alt="image" src="https://github.com/user-attachments/assets/a937709f-4947-44c4-9c54-d53841347ccc" /> ### After <img width="1255" height="241" alt="image" src="https://github.com/user-attachments/assets/9501ba89-f8b1-4b49-b622-cc5f88703f8b" /> ## Testing Tested in Linux Wayland. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Normalize branch name in action: `git::RenameBranch`. --------- Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com> |
||
|
|
1b93c47b17 |
fuzzy_nucleo: Add StringMatchOptions and PathMatchOptions (#66747)
## Summary This PR reworks the API for `match_strings` and the like to instead take a struct. This makes this much more readable in my subjective opinion, as one no longer passes a number and bool and some default, but rather a strongly typed struct. Said struct can still be defaulted, yet one has to only pass 1 argument in that case as opposed to 4. ## Self-review - [X] I've reviewed my diff for quality, security, reliability, and performance. - [ ] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [X] Tests cover the new or changed behavior. Release Notes: - N/A |
||
|
|
051a638727 |
git_ui: Add commit view defaults for descriptions and files (#66331)
The commit view always opens with the description folded and all files
expanded.
This PR adds two settings so you can choose how it opens:
```json
"git": {
"commit_view": {
"expand_description": false,
"expand_files": true
}
}
```
Set `expand_description` to `true` to show the full commit message, or
`expand_files` to `false` to start with all changed files collapsed.
The defaults preserve the current behavior.
They are also available in Settings → Version Control → Git Commit View.
That section also absorbs the existing "Show Full File by Default"
setting from the former "File Diff" section, so everything for views
opened from a commit lives together. The JSON keys are unchanged.
The settings follow the existing `git.file_diff` pattern, and file
collapsing reuses the logic for folding binary files after the diff
loads.
Related: https://github.com/zed-industries/zed/discussions/64543
<!-- Add a screenshot of the "Git Commit View" section in Settings →
Version Control. -->
## Testing
Manually tested on Linux (Fedora 44, Wayland) with a debug build.
https://github.com/user-attachments/assets/d3db1251-de37-4978-9770-825dda15c0b0
## Self-review
- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.
Release Notes:
- Added `git.commit_view.expand_description` and
`git.commit_view.expand_files` to control whether the commit view opens
with the full commit message shown and the changed files expanded.
|
||
|
|
96508041c7 |
git_ui: Fix status entry icons overlapping right-side UI in narrow git panel (#66278)
## Summary When the git panel shrinks and becomes too narrow to contain all the UI elements of a status entry, the file name and path are truncated first, but the icons then overflow and overlap with the right-side UI (diff stats and checkbox). The reason is that although the icons are `flex_none`, they were grouped with the name and path inside a `flex_1` / `min_w_0` container, causing an overflow. This PR splits the icons and path into separate divs, keeping the icon div as `flex_none` to prevent the overflow. ## Testing Left is current, right is after the fix: [屏幕录像_20261029_155224.webm](https://github.com/user-attachments/assets/bd751480-adfd-411e-85b0-e80323b8cdfe) ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [ ] Tests cover the new or changed behavior. Release Notes: - Fixed entry icons overlapping diff stats in a narrow Git panel. --------- Co-authored-by: Kirill Bulatov <kirill@zed.dev> |
||
|
|
2311b2497c |
git_ui: Stop remote branch switches resending the full commit graph (#65436)
## Summary Closes #64605 Switching branches in a remote project streams the entire commit graph from the server to the client, even with the History tab closed. On the reporter's 313k-commit clone that is about 27 MB per switch, on the same SSH connection the terminal and file-open requests are waiting on. The same transfer happens once on every remote project open. The Git panel reacts to every repository change with `preload_commit_history`, which asks the repository for `0..0` commits so the data is ready if the user opens History. The range only limits what is read back from the cache. If the cache is empty, because `HeadChanged` just cleared it, a full `git log` starts anyway, and for a remote project `GetInitialGraphData` streams every commit regardless of range. `preload_commit_history` now returns early when the project is not local. Local projects keep the preload, where it is a background `git log` and no bytes cross a wire. Remote projects load history when the user opens the History tab, through `load_commit_history`, which already does that. This trades a remote stall for a remote delay on first open: the first time History is opened over SSH it shows the loading state while the graph streams, instead of being ready. That is the same transfer that happens today, moved to the moment the user asks for it, and skipped if they never do. The preload was not achieving readiness on remote projects anyway. A branch switch reaches the client as a head change followed by a branch-list change, and the branch-list change clears the cache the preload just filled. When the two arrive together the fetch is cancelled before its request leaves. When they arrive apart, the request has already gone out and the host streams the full graph into a cache entry that no longer exists. The follow-up that pages the remote graph transfer, so the History tab and Git graph load incrementally, is open as a draft in #65442. ## Testing Added `collab::git_tests::test_ssh_branch_switch_does_not_fetch_history`, an SSH project built with `build_ssh_project` against a headless server: 1. Opens the project with the Git panel on Changes and checks no history fetch started. 2. Switches the host to another branch, checks the client sees it, and checks no history fetch started. 3. Opens History through `ActivateHistoryTab` and checks exactly one fetch ran and the panel lists the host's commits. Fetches are counted where they start on the client, through a test-only counter on `Repository`, not by inspecting the cache, because the branch-list update after a switch clears the cache and would hide a fetch that had already started. With the fix removed, the test fails at step 1 with `opening the project with Changes selected should not fetch history`, and with that check relaxed it fails at step 2 with `switching branches with Changes selected should not fetch history`. Green: `cargo test -p collab --test collab_tests git_tests` (14), `cargo test -p git_ui` (180), `cargo test -p project --lib git_store` (25), `./script/clippy -p project -p git_ui -p collab --tests`. To reproduce by hand: open a large repository over SSH, leave the Git panel on Changes, switch branches in the terminal, and watch the connection; after this change nothing is transferred. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). No UI changes. - [x] Tests cover the new or changed behavior. Release Notes: - Fixed branch switches in remote projects resending the full Git history over SSH, which stalled the terminal and file opening until the transfer finished --------- Co-authored-by: Kirill Bulatov <mail4score@gmail.com> |
||
|
|
1253dde6ec |
git_ui: Scroll commit view to the blamed file (#65237)
## Summary Picks up #62039 by @gaojunran, which was closed as inactive, reworked per the review feedback from @cole-miller and @dinocosta. Opening a commit from git blame now scrolls the commit view to the blamed file instead of the top of the diff (see #30696). - `CommitView::open`'s optional arguments are grouped into `CommitViewOptions` (`stash`, `file_filter`, `reveal_file`), each defaulting to `None`. - Every blame entry point passes the blamed file: the gutter click, the SHA button in the blame popover and tooltip, and `editor: open git blame commit`. - Updated the commit's multibuffer building task in order to prioritize the path in `CommitViewOptions::reveal_file` in case it is set, ensuring that as soon as it's added to the `MultiBuffer` we set the scroll anchor to its `BufferHeader` block. ## Testing - Added `git_ui::commit_view::tests::test_reveal_file_preserves_header_position` which leverages the new `CommitViewOptions::reveal_file` field and ensures that the scroll position of the editor matches its buffer header, as well as the cursor being on that file's first excerpt. - Manually tested on macOS, as shown in the recording below. ### Showcase https://github.com/user-attachments/assets/cf697fe1-b9f1-470a-a5ad-fe0ed93f304a ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Improved opening a commit from git blame to scroll to the blamed line --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: dino <dinojoaocosta@gmail.com> |
||
|
|
e231594b6b |
git: Add date format and per-view date style settings (#66533)
## Summary resolves #15272, take 2 of #58950 tl;dr: add following options: ```json { "git": { "date_format": "locale", // "locale" (default), "iso", or a strftime format like "%Y-%m-%d %H:%M" "blame": { "date_style": "relative" }, "inline_blame": { "date_style": "relative" }, "branch_picker": { "date_style": "relative" }, "stash_picker": { "date_style": "relative" } }, "git_panel": { "date_style": "relative" }, "git_graph": { "date_style": "absolute" } } ``` design per https://github.com/zed-industries/zed/pull/58950#issuecomment-6017682621, also pinging @smitbarmase per request ## Testing screenshots are taken on fedora linux 44 + kde plasma 6.7.5 <img width="2560" height="1440" alt="image" src="https://github.com/user-attachments/assets/0784f1f7-0e00-4be5-893d-775d617b33e4" /> <img width="1125" height="937" alt="image" src="https://github.com/user-attachments/assets/7ae6c876-3a93-4876-a151-85632d54d982" /> <img width="1407" height="340" alt="image" src="https://github.com/user-attachments/assets/2178804a-444b-4613-9024-3700b15e0cfe" /> changed each config values `Date Format {locale/iso/strftime} x Date Style {relative/absolute}` and they all seem to work without issues also, invalid date format will default to `locale` (with an warning log like below) ``` 2026-11-05T00:14:08+09:00 WARN [project::project_settings] Invalid git.date_format: invalid component name `Q` at byte index 1 ``` ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Added `git.date_format` and per-view `date_style` settings for git dates --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|
|
e40e600719 |
git_ui: Preserve line breaks in commit message view (#66608)
The commit view renders the commit message as Markdown using the hover style, which treats single newlines as soft breaks. Hard-wrapped commit bodies were therefore reflowed into a single paragraph. This sets `soft_break_as_hard_break: true` on the commit view's `MarkdownStyle`, so messages keep their original line breaks. <img width="3786" height="470" alt="Screenshot From 2026-11-06 10-23-54" src="https://github.com/user-attachments/assets/7ac99615-6999-4b6b-a0fc-81391b630bff" /> ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed commit messages losing their line breaks in the commit view |
||
|
|
ddc9eda925 |
git_ui: Show changes since a base branch in the git panel (#66482)
Closes #66458 Closes https://github.com/zed-industries/zed/discussions/48185 Closes https://github.com/zed-industries/zed/discussions/66301 Closes https://github.com/zed-industries/zed/discussions/65750 Follow-up to #66461 The Changes header has a new menu button with two options: - Uncommitted shows your staged and unstaged changes, same as before. It's the default. - Compare Against Base opens a submenu with a branch picker. Pick a branch like `origin/main` and the panel switches to branch mode, listing every file your branch changed since then. The button then reads `Since origin/main`. What changed: - Clicking a file opens its diff against the base and scrolls to it. If a diff tab for that base is already open, it reuses it. - List and tree view and sorting work the same as in Uncommitted mode. - Switching bases shows a loading state until the new base's files load. - The "View Branch Diff" button in the empty state now also switches the panel to branch mode. In a repo with no default branch it used to open an empty diff. It now asks you to pick a base first. - Uncommitted mode remains the same as before. Some calls I made: - In this mode action like staging does not really make sense so rows are read-only. One row can have both committed and uncommitted changes. You can still open diffs, copy paths and commit. - In branch mode the base branch follows the active branch diff tab base branch, like outline panel. It doesn't work the other way. You can have several diff tabs open against different bases, and the panel can't know which one you'd want to change, so picking a base in the panel only changes the panel, and you will have to click "View Diff" next. https://github.com/user-attachments/assets/66a9ee24-f8bc-4c5d-a984-b5d2f280f9f4 Left for follow-ups: - Line counts like `+12 -3` on branch rows. - Moving the History tab's state into its own type, like branch mode has here. `GitPanel` holds state for every tab and mode in one struct, so changing one part tends to touch the others. - The branch filter button in the submenu picker is hidden on purpose. There is some gpui/ui fixes needs to render tooltip and its popover over this new embedded view. I'll fix that separately. Release Notes: - Added a branch mode to the git panel that lists all files changed since a base branch, such as `origin/main`. |
||
|
|
2dcdc4f216 |
git_ui: Make JetBrains Ctrl-K focus the commit message (#66330)
In the JetBrains keymap, `ctrl-k` (`cmd-k` on macOS) toggles focus on the Git Panel. If the panel is on History, the shortcut leaves you there instead of taking you to the commit message. This PR binds the shortcut to `git_panel::FocusEditor` and makes that action available from the workspace. It opens the Git Panel, switches to Changes, shows the commit editor if hidden, and focuses it. Pressing the shortcut again keeps focus on the commit message. `alt-0` / `cmd-0` still toggles focus between the Git Panel and the editor, and the existing `tab` / `shift-tab` bindings in the changes list keep their behavior. ## Testing Manually tested on Linux (Fedora 44, Wayland) with a debug build and `"base_keymap": "JetBrains"`. 1. With the Git Panel on History and the editor focused, press `ctrl-k`: the panel switches to Changes and focuses the commit message. 2. Repeat with the History list focused and with the Git Panel closed. 3. Hide the commit editor and press `ctrl-k`: it becomes visible and receives focus. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed `ctrl-k` (`cmd-k` on macOS) in the JetBrains keymap to focus the commit message, including when the Git Panel is on History or closed. --------- Co-authored-by: Kirill Bulatov <mail4score@gmail.com> |
||
|
|
ba36af2050 |
Revert "Reduce waits for navigation, suggestions, and file comparisons (#66487)" (#66517)
This reverts commit
|
||
|
|
7e7311ad20 |
Reduce waits for navigation, suggestions, and file comparisons (#66487)
# Objective Reduce waiting when navigating code, loading details for code suggestions, and comparing files. Zed currently starts some independent file reads and requests only after the previous one finishes. ## Solution - Load up to 16 definition or reference results at once. Keep their original order. Repeated results for the same file share one read and one open copy of the file. - Request details for up to 16 code suggestions at once. Repeated item indexes produce one request. Successful items still update if one request fails. Keep the checks that each language server supports the request. - Read both sides of a file comparison together. Load up to 16 comparison pairs at once, while keeping their display order. - Add controlled-delay tests. Saved file contents and the text ranges returned by navigation stay the same. ## Testing On current `main` at `8a47b35109`: - 748 tests passed across `project`, `git_ui`, and `git_ui_core`. Four tests were already ignored. Each suite ran one test at a time. - Seven timing and behavior tests passed across 100 task execution orders each: 700 runs. They check result order, repeated files and suggestions, the request limit, errors, and cleanup. - Required `./script/clippy` passed for all three packages, with all targets and all features. Its dependency check also passed. The check used no debug symbols and `profile.release.opt-level=0` to limit build storage. - Formatting and `git diff --check` passed. The original checkout measured the following controlled delays. The port to current `main` passes the same 40 ms checks: | Operation | Before | After | | --- | ---: | ---: | | Go to definition across three unopened files | 120 ms | 40 ms | | Find references across three unopened files | 120 ms | 40 ms | | Load details for three code suggestions | 120 ms | 40 ms | | Open one file comparison | 80 ms | 40 ms | | Open three file comparisons | 240 ms | 40 ms | Each independent read or request has a deliberate 40 ms delay. These results prove reduced waiting in these cases. They do not establish a whole-application speed improvement. Remote network performance and the best concurrency limit for each machine remain unmeasured. The earlier checkout also passed all five checks in a clean-built macOS app. Those built-app checks predate this port. They are separate from the current-main checks above. Reviewers can run the focused tests with: ```sh ITERATIONS=100 cargo test -p project -p git_ui -p git_ui_core --features project/test-support concurrently -- --nocapture ``` ## Self-Review Checklist - [x] Reviewed the changes for correctness and cleanup of completed or failed work - [x] Added tests for the changed behavior and measured waiting time - [x] Kept result order and bounded active work ## Suggested .rules additions Proposed text for the project test guidance, for review in a separate rules change: > In GPUI tests that check the release of invisible worktrees, drop the final buffer handles inside `cx.update(...)`, then check the remaining worktrees. `run_until_parked()` alone does not flush deferred entity releases. Release Notes: - Improved responsiveness when navigating code, loading completion details, and comparing files. |
||
|
|
f4d40a2ccb |
git_ui: Drag files from the git panel to the terminal (#66423)
Files in the git panel's Changes list can now be dragged, just like entries in the project panel. Dropping a file on a terminal inserts its absolute path, and dropping it on a pane opens it. The rows reuse the project panel's `DraggedSelection` payload, so existing drop targets accept them without changes. When the dragged row is marked, the drag carries all marked files and directories, and the preview shows the entry count. Deleted files have no project entry and are not draggable. <!-- Add a GIF of dragging files from the git panel to the terminal. --> ## Testing https://github.com/user-attachments/assets/0d63ce06-057b-432b-97aa-747f6e8d09dd ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Added support for dragging files from the git panel to the terminal and editor panes. |
||
|
|
422b53cff8 |
git_ui: Keep the open commit highlighted in the History tab (#66226)
Closes #65488 Supersedes #65772 Supersedes #65774 After opening a commit from the History tab and clicking into the commit view, its row had no marker. History rows only showed the focus border, and only while the panel had focus during keyboard navigation. History now highlights the commit open in the active tab, matched by sha, and clears it when another tab is active. The keyboard cursor follows the open commit and no longer starts on HEAD. The focus border now only shows after keyboard input instead of flashing on click. https://github.com/user-attachments/assets/4be21893-9055-4a32-a58c-a9eeaa08fbc7 Release Notes: - Fixed the History tab in the git panel losing the highlight on the open commit when you click into the commit view. |
||
|
|
bfd1dd484b |
git_ui: Fix vertically misaligned author cells in Git graph (#66187)
## Summary Ever since avatars were added to the author column in #59839, the avatar and name have sat lower than the other columns. The author cell was forced to the full row height, making it taller than its neighbours. It now sizes to its content. As the cell no longer has a fixed height, the author label is always rendered (even when empty) so the cell's height and the avatar's position don't shift when commit data finishes loading. ## Testing | Before | After | |--------|-------| | <img width="381" height="304" src="https://github.com/user-attachments/assets/b5c90dcf-4076-4d85-9d20-53cba25e0e11" /> | <img width="381" height="304" src="https://github.com/user-attachments/assets/bdc0df20-0dc3-4a03-a687-dcb475f8a978" /> | ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [ ] Tests cover the new or changed behavior. Release Notes: - Fixed author names and avatars being vertically misaligned in the Git graph. |
||
|
|
5a534d7b5d |
git: Add git auto fetch (#53089)
## Summary
Adds an opt-in periodic background `git fetch --all` for local
repositories, so remote-tracking branches and ahead/behind counts stay
current without a manual fetch.
Because the fetch runs unattended, it behaves differently from a
user-initiated fetch:
- **Trusted repositories only.** Re-checked on every tick, since a
worktree can be trusted or restricted at any point in a session.
- **Never prompts.** Credentials that need no interaction (e.g. an SSH
agent, or a credential helper answering from a keychain) still work.
Anything that would need input fails instead of blocking on a prompt
nothing will answer.
- **Silent.** No activity indicator in the status bar, since a spinner
every minute is noise. Failures are logged at debug level.
- **Stays out of the user's way.** It runs off the repository's serial
job queue, so status refreshes and staging aren't stalled behind the
network. A user-initiated fetch, pull, or push preempts an in-flight
background fetch rather than waiting for it.
- **Leaves the repository clean when stopped.** Stopping a fetch (a
settings change, preemption, closing the project) asks git to terminate
so it can remove its ref lockfiles, rather than killing it and leaving a
stale `.lock` behind that breaks every later fetch. It also never
triggers auto-maintenance on the user's behalf.
## Configuration
```json [settings]
{
"git": {
"auto_fetch": {
"enabled": false,
"interval_secs": 60
}
}
}
```
- `enabled` (default `false`): whether to fetch from all remotes in the
background.
- `interval_secs` (default `60`, clamped to a minimum of `15`): how
often to fetch.
Both are exposed in the settings UI under **Version Control > Git
Integration**, where the interval is only shown while auto-fetch is
enabled, and documented in `docs/src/reference/all-settings.md`.
Unrelated settings changes don't restart the timer.
## Implementation design
### `GitCaller`
The remote-capable `GitRepository` methods (`fetch`, `pull`, `push`,
`commit`) take a `GitCaller` instead of a bare `AskPassDelegate`:
```rust
pub enum GitCaller {
/// A user started this and is waiting on it. Prompts route to the UI.
User(AskPassDelegate),
/// No user attached. Never prompts, and stops when the receiver resolves.
Background(Option<oneshot::Receiver<()>>),
}
```
Every such command goes through `GitBinary::run_remote_command`, which
applies everything the caller implies. git, credential helpers, and ssh
each prompt through a different mechanism, so keeping the list in one
place means no call site can miss one. For `Background`:
| Prompt channel | Mitigation |
| --- | --- |
| git's own terminal prompt | `GIT_TERMINAL_PROMPT=0` |
| Credential helpers | `credential.interactive=false`, which is narrower
than clearing `credential.helper` so helpers that answer without
prompting keep working |
| askpass | `core.askPass=`, and `GIT_ASKPASS`/`SSH_ASKPASS` unset |
| ssh (key passphrases, host key confirmation) | `-o BatchMode=yes`
composed onto the ssh command git would otherwise use
(`GIT_SSH_COMMAND`, then `core.sshCommand`, then `ssh`), so custom ssh
commands keep working. Setups that only set the deprecated `GIT_SSH` are
left alone, since setting `GIT_SSH_COMMAND` would silently replace them.
|
`gc.auto=0` is also set, since auto-maintenance can repack the whole
repository. gpg's pinentry when signing isn't covered, as no background
caller signs.
### Cancellation
A background command is spawned with `kill_on_drop` and raced against
its cancel receiver, where a dropped sender counts as cancellation:
1. If already cancelled before spawning, git is never started.
2. On cancellation, git is sent `SIGTERM`
(`util::process::request_termination`), which runs its handlers that
remove lockfiles.
3. If it hasn't exited within a 2s grace period, it's killed.
Windows has no equivalent signal, so cancellation there is a kill.
### Scheduling
- Each repository has a timer task, restarted only when `enabled` or
`interval_secs` change.
- On each tick, the timer checks trust, then tries to acquire the
repository's `fetch_lock` semaphore and skips the tick if it's held. It
spawns a **detached** fetch task that holds the permit until the fetch
settles.
- `AutoFetchState.cancel` holds the sender, and is the only thing
bounding the fetch's lifetime. It's dropped on a settings change, on
preemption, and when the repository is dropped, so every way of stopping
a fetch goes through graceful cancellation.
- Running off the serial job queue is safe because auto-fetch mutates no
`Repository` state. It only updates remote-tracking refs, which git
guards with its own lockfiles, and the results reach the UI via the
resulting git directory rescan. Manual fetch stays on the queue, since
it also writes snapshot state via `refresh_branch_list`.
- `fetch`, `pull`, and `push` call `preempt_auto_fetch()`, which drops
the cancel sender, then wait on `fetch_lock` inside their job. That wait
is bounded by a cancelled fetch shutting down rather than by the
network, and stops them failing with "cannot lock ref" against a
background fetch.
## Test plan
`test_auto_fetch` covers:
- [x] An untrusted repository is never auto-fetched, and fetching begins
once its worktree is trusted
- [x] Timer fires on schedule, and again on the following interval
- [x] Unrelated settings change mid-interval doesn't reset the timer
- [x] Disabling `auto_fetch` stops all fetches
- [x] Re-enabling with a longer interval respects the new cadence
## Review
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Addresses
#24611(https://github.com/zed-industries/zed/discussions/24611)
Release Notes:
- git: Added option (off-by-default) to automatically fetch upstream of
the current branch and default upstream of the project. Enable it with:
```
{
"git": {
"auto_fetch": {
"enabled": false,
"interval_secs": 60
}
}
}
```.
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Codex (GPT-6) <noreply@openai.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
|
||
|
|
87ce147829 |
git_ui: Make git graph refs its own column & resizable (#66260)
## Summary Since https://github.com/zed-industries/zed/pull/59839 we moved the ref labels outside of the description column, but this introduced for some people a worse UX, because they have a very long branch names that now couldn't be shown anymore since we truncate the label based on a min/max available space. So I think making the ref labels its own column so that you can resize the column to your own liking makes sense so that people can view they ref labels based on their own liking column size that was also suggested in https://github.com/zed-industries/zed/issues/65681 which i agree with. As you can see now inside the after video the column can now be resized and allows you to see more of your ref labels if needed :). **Before** <img width="1512" height="821" alt="Screenshot 2026-10-28 at 18 56 09" src="https://github.com/user-attachments/assets/63090314-dce6-4b0f-9dd4-f8419fc8964d" /> **After** https://github.com/user-attachments/assets/76a1a4a1-451d-41de-8068-039e38255030 ## Testing I validated that everything still works like selecting/highlighting a row and toggling of rows as you can see inside the **after** video and added tests that cover the new behavior. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Added a resizable "Refs" column to the git graph that can be toggled on or off from the column header's context menu |
||
|
|
fae4b2ea4f |
workspace: Fix local file opens with remote workspaces (#65771)
## Summary Closes #58773 While working on this, I noticed that project grouping and workspace lookup used different connection comparisons. I unified them around the existing `RemoteConnectionIdentity`. I also simplified the relevant code, removing redundant lookup and comparison helpers and borrowing values instead of cloning them when the caller only needs to read the data. ## Testing Added corresponding test coverage ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed local files opening as empty buffers in remote workspaces. --------- Co-authored-by: Kirill Bulatov <kirill@zed.dev> |
||
|
|
57c7b10ece |
git_ui: Avoid cloning repository snapshot when rendering Git graph (#66180)
## Summary While looking into some performance issues with larger repositories, I noticed that we call the method **snapshot** inside the **commit details** & **ref label** render function, that clones the whole snapshot even though we only need to know the branch name. So we don't have to own/know the whole snapshot/state, so we can avoid doing this by using the [deref reference of the repository snapshot](https://github.com/zed-industries/zed/blob/85813709288520354d58b89e6986f05c958810b0/crates/project/src/git_store.rs#L750-L756). ## Testing I tested that it still shows the right branch, which it should. Because we still point to the same value, but we just skip a clone per ref label that is inside the git graph :). ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Improved Git graph rendering performance by avoiding unnecessary repository state clones. Co-authored-by: Kirill Bulatov <kirill@zed.dev> |
||
|
|
08104dc649 |
git_ui: Add missing tooltips to Git Graph commit details (#66016)
## Summary - **Close button**: "Close Details Panel" with its keybinding (`menu::Cancel`). It uses `Tooltip::for_action_in` with the Git Graph's focus handle, so the keybinding shown doesn't change depending on what else is focused (e.g. with the terminal focused, `Tooltip::for_action` showed a different binding than the one that works in the Git Graph). - **Commit message disclosure**: "Show Commit Message" / "Hide Commit Message", matching the existing "Show/Hide Commit Details" disclosure in the same panel. - **"View on <provider>" button**: "Open in Browser". The label is truncated when the panel is narrow, so the tooltip also makes the action clear in that case. **Close button** <img width="538" height="236" alt="image" src="https://github.com/user-attachments/assets/524103cc-91ba-4357-974e-23c47d681b74" /> **Commit message disclosure** <img width="316" height="249" alt="image" src="https://github.com/user-attachments/assets/b9ab5379-29f2-4010-9d7f-7610966d50dc" /> **View on GitHub** <img width="349" height="114" alt="image" src="https://github.com/user-attachments/assets/84aabae0-8f84-43d8-9c2a-b4b123ea52f7" /> Release Notes: - Improved Git Graph commit details panel by adding missing tooltips to the close, commit message, and "View on" buttons. --------- Co-authored-by: Remco Smits <djsmits12@gmail.com> |
||
|
|
08cbb88a15 |
git_ui: Fix git graph lagging when toggling commit details panel (#66132)
## Summary Currently the git graph canvas and ref-label gutter widths were computed in `render` from `RedistributableColumnsState::cached_container_width`, which is only updated during prepaint and doesn't notify. When the commit details panel opened or closed, the graph column was rendered with the previous frame's container width and stayed stale until something else triggered a re-render, such as the commit diff finishing loading or hovering a row. We now size the canvas and gutter through layout instead, the canvas fills the graph column with a minimum of its content width, and the gutter is capped at half the graph column via `max_w(relative(0.5))`. **Before**: https://github.com/user-attachments/assets/ee3fcfc6-e392-491c-bd3c-827eb64ecb37 **After**: https://github.com/user-attachments/assets/518f0c3f-603d-4f99-a391-1ff546ccaf7e ## Testing You can test this by opening the Git graph for the Zed repository and scrolling down to a section with a lot of graph lines. Click a commit to open the commit details panel. You may already notice some lag, but it's less visible because loading the commit details triggers several re-renders. Then close the commit details panel. This is where the lag is most noticeable. Closing the panel triggers only a single re-render, and that render still uses the previous frame's cached container width. Updating the cached width doesn't trigger another re-render, so the graph stays at its old size until something else does, such as hovering a row. I also tested that adding/removing columns still works the same, and shrinking/growing the graph will works. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed git graph draw lagging behind when opening/closing the commit view |
||
|
|
389c22e1c7 |
gpui: Make Modifiers::secondary web platform aware (#65970)
This introduces a new PlatformInfo abstraction that allows querying a gpui app's platform from runtime facts. This is necessary for correctness when dealing with web applications, as their host platform there is a runtime fact, not a compile time fact. Release Notes: - [GPUI] Fixed platform-dependent modifiers and keybinding parsing and formatting in web applications by querying the host operating system at runtime. |
||
|
|
0eb085876e |
Use recent commits to improve message generation (#61528)
## Summary Commit message generation now includes the three most recent repository commit messages as style examples alongside the diff. ## Problem The generator previously had no visibility into the repository's recent commit conventions. As a result, generated messages could drift from the project's established style, including its use of scopes, bodies, and release-note sections. ## Benefits - Keeps generated commit messages aligned with the repository's current conventions. - Preserves full recent commit messages so the model can learn both subject and body formatting. - Handles repositories with fewer than three commits or unavailable history without blocking generation. - Starts history lookups alongside diff collection to avoid adding unnecessary serial latency. ## Testing - `git diff --check` passed. - `cargo test -p git_ui test_commit_message_prompt --lib` could not run because `cargo` is not installed in the environment. - `cargo fmt --all -- --check` and `./script/clippy -p git_ui` could not run for the same environment limitation. Release Notes: - Improved AI commit message generation by using recent repository commit history for style consistency. Last 3 commit messages are now sent out to the message-generating model as reference for style. --------- Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com> |
||
|
|
1416404b88 |
git_ui: Keep staged changes when discarding from the unstaged section (#65559)
## Summary Closes #63047 In other IDEs like VSCode (and its variants) I got used to being able to discard unstaged changes of a file while leaving its staged changes in place, but Zed currently behaves differently and caused me to lose whole files a few times. I think this is unexpected behavior, so this PR updates how the git panel handles discarding changes to something I personally find more intuitive in the hopes that other people do too. @mmalk3 reproduced [the behavior](https://github.com/zed-industries/zed/issues/63047#issuecomment-5386884858) and recorded this video which I'm reusing: https://github.com/user-attachments/assets/0f54db8e-0015-497f-896e-ae3954055e3c #63073 fixed this, but was an incomplete experience IMO and was never merged. I'm taking a slightly more holistic approach so that nothing about the experience feels buggy. These felt like the minimum required behavior changes around the original bug fix: 1. When selecting a file that has both staged and unstaged changes, two rows were selected. Leaving that in place made it unclear what was actually going to be affected by the "discard" action, so I adjusted selections to be scoped to their panel. You can still select a file that exists in both sections by clicking it in both panels if you wanted to. 2. "Trash Untracked Files" would trash staged files that were untracked. I updated the action to only affect untracked files that are also unstaged, but I'm open to reverting this so I added it as a separate commit. ## Testing 1. The original bug fix: discarding unstaged changes leaves the staged changes in place. https://github.com/user-attachments/assets/e89da0c3-b14f-47aa-88b6-0e344ef9375b 2. All changes can still be discarded by trashing the changes from the staged panel. I could see arguments for this being a different experience but it's the existing behavior so I didn't want to remove it. https://github.com/user-attachments/assets/47844acb-064e-4ae8-9cac-87d1a426c6f6 3. This is the new multi-select behavior. If the same file is in both the staged and unstaged panels, selecting one row does not automatically select the other -- but you can still select both. When you select both, it'll behave the same as if you selected the staged file and discard all changes. https://github.com/user-attachments/assets/f01e4b82-1e72-4860-8709-254a416ca9cd 4. This is the new "Trash untracked" behavior. Only unstaged files that are also untracked can be trashed via this action. If the untracked file is staged, it's protected (including the unstaged changes). If there are no untracked files or they are all staged (partially or completely), the button is disabled. https://github.com/user-attachments/assets/6a477a40-5d94-4dea-9bc1-3e280a1c579b ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed discarding unstaged changes in the git panel also discarding staged changes --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|
|
e39fb7c2e0 |
gpui: Rename ScrollWheelEvent to ScrollEvent and add trackpad scrolling on iOS (#65805)
Scrolling in GPUI comes from mouse wheels and trackpads reported by the OS, and from touch pans that GPUI recognizes itself. All of them arrived as `ScrollWheelEvent`, and handlers had no way to tell a finger pan from anything else. ## API change - `ScrollWheelEvent` → `ScrollEvent`, with a new `source: ScrollSource` field. - `ScrollSource` has two variants: - `Pointer` (the default): a scroll the platform reported from a mouse wheel or trackpad. `ScrollDelta::precise()` still tells continuous devices apart from wheel notches. - `Touch`: a finger pan recognized by GPUI, including its synthesized momentum. - `on_scroll_wheel` → `on_scroll`. - `PlatformInput::ScrollWheel` → `PlatformInput::Scroll`. ### Compatibility Existing app code keeps compiling: `ScrollWheelEvent` and `on_scroll_wheel` remain as deprecated aliases. Two things still need changes: - Platform backends must switch to `PlatformInput::Scroll`. Rust can't alias an enum variant. - `ScrollEvent` literals that list every field must add `source`. Literals using `..Default::default()` get `ScrollSource::Pointer`. ## Trackpad and mouse-wheel scrolling on iOS `gpui_ios` previously handled only raw touches, so trackpads and mice on iPad couldn't scroll. The backend now adds a `UIPanGestureRecognizer` to the Metal view that accepts all scroll types and sends each step as a `ScrollEvent` with the pointer position and modifiers. The recognizer has an empty `allowedTouchTypes` and `cancelsTouchesInView = false`. That way it never claims finger touches, which keep going to `touchesBegan` and GPUI's touch recognizer. UIKit ends these gestures when the fingers lift and leaves momentum to the app. So for now a trackpad scroll on iOS stops when the fingers lift, without the post-release glide that native views have. ## Verification Done on Linux: - `cargo test -p gpui --features test-support --lib -- gestures list:: scroll`: 72 passed. - `./script/clippy -p gpui -p gpui_linux`: clean. - `cargo clippy` for `gpui_ios` (`aarch64-apple-ios`) and `gpui_macos` (`aarch64-apple-darwin`): clean. - `cargo check -p gpui_web` (`wasm32-unknown-unknown`): clean. - A temporary downstream-style test confirmed that code using `ScrollWheelEvent` and `.on_scroll_wheel(...)` still compiles and receives scrolls. Not verified: - **Windows:** wasn't type-checked locally, because `gpui`'s build script needs the Windows resource compiler. CI covers it. - **iOS behavior:** trackpad and wheel scrolling on an iPad hasn't been tried. Specifically unconfirmed: scroll direction under natural scrolling, and that finger pans don't also trigger the scroll recognizer. Release Notes: - [GPUI] Renamed `ScrollWheelEvent` to `ScrollEvent` and `on_scroll_wheel` to `on_scroll` (old names remain as deprecated aliases), added `ScrollEvent::source` to distinguish pointer scrolling from GPUI-recognized touch pans, and added trackpad and mouse-wheel scrolling on iOS --------- Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com> |
||
|
|
93d7456688 |
git_ui: Fix commit editor button hover colors (#65448)
## Summary Closes #65376. Replaces #65411 with the hover behavior handled inside the button component, as requested in review. My original description of the problem: > The main problem is when I hover in the blank area the icon color got changed Each commit editor button now uses 0.6 opacity normally and 1.0 only while that button is hovered. The opacity options are handled by `IconButton` and `ButtonLike`, and the component preview includes an example. ### Before fix https://github.com/user-attachments/assets/b7ad6980-e382-4bef-904a-74d877da0291 ### After fix https://github.com/user-attachments/assets/3089e783-c54a-4a94-9e47-a169483aface ## Testing - Built and ran the development app on macOS. Manually checked blank-area hover, each icon independently, expand/collapse actions, and light and dark themes. - `cargo test --locked -p ui --lib`: all 89 existing tests passed. This visual change is covered by manual testing; no dedicated automated regression test was added. - `cargo fmt --all -- --check` and `git diff --check` passed. - `cargo build --locked -p zed --bin zed` passed with the macOS development environment configured. To check, open a Git repository and its Git panel. Move the pointer between the blank space below the commit editor buttons and each button. Only the hovered button should brighten. Also expand and collapse the commit editor. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior through the manual checks described above. Release Notes: - Fixed Git panel commit editor buttons changing opacity when hovering empty space. --------- Co-authored-by: MrSubidubi <finn@zed.dev> |
||
|
|
b47a4ca595 |
git_ui: Clarify remote-tracking branch delete in branch picker (#61793)
Closes #56525 # Objective Zed's branch picker shows a "Delete Branch" trash icon for both local and remote-tracking branches. For remote-tracking branches (e.g. `origin/feature`), this action only deletes the local tracking ref (`git branch -dr`) — it never contacts the remote, and the branch still exists on the actual remote repository. The label gives no indication of this, so users can't tell whether the action is local-only or will delete the branch upstream. ## Solution `Branch.is_remote()` was already used internally to pick the right git flag (`-d`/`-dr`) when deleting, but this distinction was never surfaced in the UI copy. This PR threads that same `is_remote` value through to the delete tooltip and branches the displayed text on it: - Local branch: unchanged — "Delete Branch" / "Force Delete Branch", with the existing "Hold alt to force delete" hint. - Remote-tracking branch: "Delete Local Tracking Branch" / "Force Delete Local Tracking Branch", with a "Does not delete the branch on the remote" hint. Also updated the stale `DeleteBranch`/`ForceDeleteBranch` action doc-comments, which still said "Deletes the selected git branch or remote" — a leftover from an earlier (already-fixed, see #48338) implementation that really did delete the whole remote config. No behavior change to the underlying delete logic — this is a copy-only fix that makes existing, correct behavior legible to the user, per [maintainer guidance on the issue](https://github.com/zed-industries/zed/issues/56525#issuecomment-5095069397). ## Testing - `cargo check -p git_ui` passes. - Manually verified in the branch picker: hovering the trash icon on a local branch shows the original text; hovering it on a `origin/...` remote-tracking branch shows the new "local tracking branch" text and meta line, for both the plain and alt-held (force) states. - No behavior/logic change, so no new automated test was added — purely a UI string change in `DeleteBranchTooltip::render`. - Reviewers: open a repo with at least one remote-tracking branch visible in the branch picker (`git fetch` a repo with a branch you don't have locally), hover the delete icon on it vs. on a local branch, and compare tooltip text. ## 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) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Showcase Before: hovering the trash icon on `origin/feature` shows "Delete Branch" / "Hold alt to force delete" — identical to a local branch, no indication the remote is untouched. After: hovering it shows "Delete Local Tracking Branch" with meta text "Does not delete the branch on the remote". --- Release Notes: - Improved the branch picker to clarify that deleting a remote-tracking branch only removes the local ref, and removed the force delete option for remote-tracking branches since it had no effect. --------- Co-authored-by: Agus Zubiaga <agus@zed.dev> Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|
|
0849124bc2 |
Ensure more snapshots are used after .await points (#65219)
Follow-up to https://github.com/zed-industries/zed/pull/65193 Release Notes: - N/A |
||
|
|
2240542744 |
Fix file_type matching for local single-file worktrees (#60307)
## Objective - Fixes: https://github.com/zed-industries/zed/issues/60304 ## Solution Fixes custom `file_types` language matching for single-file worktrees. Adds a new `file_system_abs_path` API with full local or remote filesystem paths for glob matching. ## Testing New tests ensure `file_types` takes precedence over `path_suffixes` in single file worktrees, both locally and remotely. I manually validated builds with this change are also fixed on: 2026-07-02 and 2026-10-05. Validation: 1. Make sure you do not have SSH Config extension installed. 1. Add `"file_types": {"Rust": ["**/.ssh/config"]}` to your zed settings.json: 1. From a command prompt: ```shell mkdir -p /tmp/foo/.ssh/ touch /tmp/foo/.ssh/config # these work now: cargo run -- /tmp/foo/.ssh/config cargo run -- ssh://think21:~/.ssh/config ``` 1. In Nightly language is shown as "Unknown" / in this branch is shows as "Rust". ## Self-Review Checklist: - [Yes] I've reviewed my own diff for quality, security, and reliability - [N/A] Unsafe blocks (if any) have justifying comments - [N/A] 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) - [Yes] Tests cover the new/changed behavior - [Yes] Performance impact has been considered and is acceptable --- Release Notes: - Fixed language association for `file_type` path globs with single-file worktrees --------- Co-authored-by: Kirill Bulatov <kirill@zed.dev> Co-authored-by: Kirill Bulatov <mail4score@gmail.com> |
||
|
|
cac9d17a6c |
git_ui: Add Create Tag action to commit context menus (#65194)
I've been wanting a `Create Tag...` git context menu action for some time now. I saw that we landed [a commit that adds an action to add a tag at HEAD](https://github.com/zed-industries/zed/pull/61973), which did 99 percent of the legwork, so seemed like a good time to land this. Release Notes: - Added the ability to create tags on commits from the Git history and Git graph context menus. |
||
|
|
5eed2397a8 |
git_ui: Add command to create tags at HEAD (#61973)
Add a Command Palette action that creates a lightweight local tag at the active repository's HEAD. Refresh tag consumers after creation and show success or failure notifications. # Objective This adds a `git: create tag at head` Command Palette action for creating a lightweight local tag at the active repository's current `HEAD`. ## Solution The action uses the existing single-line Git modal style and notification patterns. Tag creation uses `git update-ref` with a required nonexistent previous value, preventing an existing tag from being overwritten. It also: - Supports local and remote project repositories. - Refreshes Git graph and history views after tag creation. - Shows a bottom-centered success toast. - Uses the existing critical error prompt for failures. - Documents that created tags are local and are not pushed automatically. ## Testing - `cargo test -p git test_create_ref_requires_ref_to_not_exist` - `cargo test -p git_ui test_create_tag_at_head` ## Showcase https://github.com/user-attachments/assets/81ceffdb-d5f7-4e97-b513-4ee04b55b619 --- Release Notes: - Add command to create tags at HEAD --------- Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com> Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com> |
||
|
|
a9c0144d00 |
git_ui: Improve Git graph UX (#59839)
# Objective Currently the UX of the git graph is pretty bad, since we are displaying all the refs inside the **description** column we bairly have room for the description itself. It's also pretty hard to implement any more advanced features like renaming/deleting a specific ref for example. ## Solution My solution/idea is to move the refs to the git graph itself, so we have more room to show the actual commit description, and we also move towards a UI where it's possible to implement renaming/deleting of refs for example. I got inspired by this [tweet](https://x.com/ruru_1x/status/2068021793173172351) that shows a really clean git graph similar to how [git kraken](https://www.gitkraken.com) does it. I think Zed should also move to a UI similar to this, so we can make some more advanced features and make them discoverable without blocking other parts of the UI e.g. tooltips of the commit description. ## Self-Review Checklist: - [x] 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 **Before** <img width="1512" height="821" alt="Screenshot 2026-06-24 at 17 45 49" src="https://github.com/user-attachments/assets/620d04d2-581b-4d78-b8fa-17f6aee7807e" /> **After** <img width="1512" height="820" alt="Screenshot 2026-07-08 at 17 22 37" src="https://github.com/user-attachments/assets/ae6b55e2-7b9b-4f7a-a393-a0943798eb50" /> <img width="823" height="581" alt="Screenshot 2026-07-08 at 17 24 47" src="https://github.com/user-attachments/assets/468e36fb-d615-452d-b96a-0161cffd8103" /> https://github.com/user-attachments/assets/0d0549c8-2593-4f1e-b3da-239bdbc3d22d --- Release Notes: - Git graph: Improved the UX of the git graph. --------- Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com> |
||
|
|
c83abe7d0e |
git_ui: Allow collapsing the commit editor and commit details (#63236)
## Summary - The commit message editor in the Git panel is pinned to six lines and its only two controls both make it *larger* — one fills the panel, the other opens the modal. Anyone who commits from a terminal pays for an input they never use, and the Changes list is what gets squeezed. - In the Git Graph detail panel, the author metadata and the commit message render at a fixed size above the changed-files list, so shortening the panel (e.g. dragging the terminal up) hides the file list entirely. ## Changes **Git panel — collapsible commit editor** - New `git::ToggleCommitEditor` action. - A chevron beside the commit button hides the editor down to a thin bar; the commit button row stays available. - State persists per workspace via `SerializedGitPanel`, seeded from a new `git_panel.commit_editor` setting (`expanded` | `collapsed`, default `expanded`). - Collapsing clears the fill state — a hidden editor cannot also fill the panel. - `activation_focus_handle` no longer focuses an editor that isn't rendered. **Git Graph — collapsible commit details** - A disclosure folds the author metadata (avatar, refs, email, SHA, provider link) down to a single author + short-sha line. - A second disclosure folds the commit message body. - The changed-files container is already `flex_1().min_h_0()`, so it reclaims the freed space with no other layout change. **Settings plumbing** - `GitPanelCommitEditor` in `settings_content`, wired through `GitPanelSettings`, `assets/settings/default.json`, the settings UI, and `docs/src/reference/all-settings.md`. ## Test plan - [x] `test_toggle_commit_editor_collapsed` added, covering the toggle, persistence of the flag, and the fill/collapse exclusion. - [x] Manually verified in a dev build: chevron hides and restores the editor, Changes list expands into the freed space, action appears in the command palette, state survives a restart, and the `collapsed` setting seeds a new workspace. - [x] Manually verified both disclosures in the Git Graph detail panel with the panel shortened, including that the collapse state survives selecting a different commit. Release Notes: - Improved the Git panel by allowing the commit message editor to be collapsed, and the Git Graph commit details by making the metadata and commit message sections collapsible. ### Evidance Test | Expand | Collapse | Settings Git Panel | | ------- | --------- | ------------------ | | <img width="675" height="965" alt="Screenshot 2026-08-26 at 15 00 46" src="https://github.com/user-attachments/assets/70c56d02-35fc-45ac-988c-24ccd6d1a19e" /> | <img width="661" height="962" alt="Screenshot 2026-08-26 at 15 00 57" src="https://github.com/user-attachments/assets/2c32fa5d-30fc-4f35-8323-afbc2a031210" /> | <img width="1041" height="956" alt="Screenshot 2026-08-26 at 16 50 40" src="https://github.com/user-attachments/assets/67f166b6-5cd9-4430-bba3-fa765715c557" /> | --------- Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com> |
||
|
|
c9daddfa0a |
git_ui: Show file counts in git panel section headers (#65028)
The section headers in the git panel (Staged / Unstaged, Tracked / Untracked, and Conflicts) didn't say how many files were in each section. With a long list of changes you had to scroll or collapse sections to get a sense of what was staged versus not. VS Code shows a small count next to each group, and this brings the same thing to Zed. Each section header now shows its file count in a small chip next to the "stage all" checkbox. The chip is hidden when a section is empty, so the pinned empty Staged/Unstaged headers stay clean. A couple of notes on the implementation: - The count comes from the same per-section lists that `update_visible_entries` already builds to render the rows, so the number always matches what's on screen. The existing `tracked_count` / `new_count` fields couldn't be reused here: there's no equivalent for Staged/Unstaged, and a partially staged file shows up in both of those sections. - In tree view the count is the number of files, not files plus directories. - The badge reuses the existing `Chip` component, which the panel already uses for tags in the history view. I added assertions to the existing grouping tests to cover the counts for both the staging and the status grouping. ## Showcase ### Staged / Unstaged <table width="100%"> <tr> <td width="50%" valign="top"> **Before** <img width="358" height="605" alt="image" src="https://github.com/user-attachments/assets/d23c7051-abf7-470a-9194-9e3ea7ae2a7e" /> </td> <td width="50%" valign="top"> **After** <img width="360" height="665" alt="image" src="https://github.com/user-attachments/assets/38e5528d-0d73-4f1d-ab30-2cd0f00b8ef1" /> </td> </tr> </table> ### Tracked / Untracked <table width="100%"> <tr> <td width="50%" valign="top"> **Before** <img width="360" height="631" alt="image" src="https://github.com/user-attachments/assets/d234321e-7f3b-4215-b9ed-34a6da8d6904" /> </td> <td width="50%" valign="top"> **After** <img width="359" height="553" alt="image" src="https://github.com/user-attachments/assets/02b702f9-89b9-4af3-876f-06ed6c1c8320" /> </td> </tr> </table> Release Notes: - Added file counts to section headers in the git panel |
||
|
|
651d693d42 |
Make Git panel file actions work with multiple selections (#64640)
# Objective Make Git panel file actions apply to the current multi-selection. View File and several context-menu actions currently act on only the focused row. ## Solution - Open every selected file, file diff, and tracked file history. - Copy selected paths as newline-separated text, preserving explicitly selected directory paths. - Add multiple selected untracked files to `.gitignore` or `.git/info/exclude`. - Show plural menu labels and avoid processing a partially staged path twice when it appears in two sections. - Keep single-file actions and the existing stage/discard behavior. ## Testing - `cargo test -p git_ui --lib` — 164 passed on Windows. - `cargo fmt --all -- --check` — passed. - `git diff --check` — passed. - New regression tests cover multi-file tabs, diffs, histories, path copying, ignore/exclude writes, and duplicate status rows. Release Notes: - Improved Git panel file actions for multiple selected files. --------- Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com> |
||
|
|
57bfce2945 |
git_ui: Enable splitting MultiDiffView (directory zed --diff) (#64967)
## Summary Enable split diffs for `zed --diff`, where the left and right sides are directories. This simply reuses the existing split diff that's already used for single-file diffs, git UI, etc. I believe this will make the Zed diff experience more consistent for use cases like `git difftool`, `jj diff --tool` etc. See #50046 for a similar change that made this work for single-file diff views. ### Before <img width="1624" height="975" alt="image" src="https://github.com/user-attachments/assets/db8c0592-8bea-4b8f-9ccc-d94456fb6208" /> ### After <img width="1624" height="976" alt="image" src="https://github.com/user-attachments/assets/c074cc5f-bdf7-4747-9ef5-4f77b3e42ee6" /> <img width="1624" height="976" alt="image" src="https://github.com/user-attachments/assets/a97026a8-312d-4a51-a9f7-24343640237a" /> ## Testing 1. `cargo build` 2. `zed --zed target/debug/zed --diff $left $right` (where `$left` and `$right` are directories) For the screenshots above, I used `jj` configuration like this. It's a little awkward to setup because the debug build of Zed looks for grammar files in `crates/grammars/src` to properly highlight everything ```toml [merge-tools.zed-tester] program = "bash" diff-invocation-mode = "dir" diff-args = [ "-c", ''' dir=$PWD cd /path/to/zed/checkout zed-preview --zed ./target/debug/zed --wait --diff "$dir/$1" "$dir/$2" ''', "", "$left", "$right" ] ``` Usage with this config: `jj show $revision --tool zed-tester` or `jj diff -r $revisions --tool zed-tester` ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - No new UI components here, just plugging existing ones together. UX should match what already existed for other usages of these components - [x] Tests cover the new or changed behavior. - In particular, added a test for the same scenario as #60914 to ensure that it works for this view Release Notes: - Enable side-by-side view for multibuffer `zed --diff` of directories |
||
|
|
74c134a3c1 |
git_ui: Don't offer git init for single-file worktrees (#64948)
## Summary Closes #62008 When a single file is opened as the project (for example `zed -n ~/demo/plain.txt`), the worktree root is the file itself. The Git panel still showed **Initialize Repository**, and clicking it always failed with a raw `Not a directory (os error 20)` toast. That's because `git init` was run with the file as its working directory. This change: - ignores single-file worktrees when choosing where to run `git init`. If only single-file worktrees are open, `git: init` shows the existing "Unable to initialize a git repository / Open a directory first" prompt instead of the OS error. - hides the **Initialize Repository** button in the Git panel when no directory worktree is open. The "No Git Repositories" label stays. - replaces the `worktrees.first().unwrap()` in `git_init` with a slice pattern. When directory and single-file worktrees are open together, the directory ones can still be initialized as before. ## Screenshots `plain.txt` opened on its own as the project, with the Git panel open. **Before**:  **After**:  ## Testing Added `test_git_init_ignores_single_file_worktrees`. It opens a single file as the project, runs `git_init`, and checks that the prompt appears and that no `.git` directory is created. The test fails without the fix and passes with it. All `git_ui` tests pass. Manual steps: 1. `mkdir ~/demo && echo hello > ~/demo/plain.txt` 2. `zed -n ~/demo/plain.txt` 3. Open the Git panel. It shows "No Git Repositories" with no **Initialize Repository** button. 4. Run `git: init` from the command palette. It shows "Open a directory first" instead of `Not a directory (os error 20)`. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed the Git panel offering to initialize a repository when a single file is opened as the project, which always failed with "Not a directory". |
||
|
|
1a28cff4b4 |
git: Stop remote operations blocking commit views (#64720)
# Objective Fixes #64078 Opening a commit from the git panel, git graph, or blame waits until any in-flight fetch, pull, or push has finished. `show` and `load_commit_diff` went through the per-repository serial job queue, so a click on a commit sat behind the whole network round trip. ## Solution Commit reads are addressed by SHA, so their result doesn't depend on what else is queued. This takes them off the queue the way #62536 did for blob reads: 1. `Repository::show_commit` and `Repository::load_commit_diff` spawn directly instead of going through `send_job`, bounded by the same semaphore as blob reads, and return a `Task` instead of a `oneshot::Receiver`. 2. The semaphore is renamed from `blob_read_limiter` to `object_read_limiter` since it now covers commits too. 3. `Repository::show` stays queued for the ref picker, which passes branch and tag names rather than shas. Both share one body in `show_internal`. `handle_show` serves both from the same `GitShow` message, so it routes by whether the payload parses as a full object id, which is how git itself resolves a 40-hex string. Worth noting one behaviour change in shallow clones: opening a boundary commit while `git fetch --unshallow` is already running used to wait for the fetch, and now shows the shallow boundary notice straight away with the button disabled until the fetch completes. The "Fetch Full History" button itself awaits the fetch explicitly before reloading, so it is unaffected. ## Testing Added three tests: - `git_store::tests::test_commit_reads_do_not_wait_on_job_queue` holds the job queue with a job that never completes and asserts `show_commit` and `load_commit_diff` resolve anyway, while `show` still waits. It fails on `main` with `show_commit waited on the job queue`. - `git_store::tests::test_commit_reads_share_object_read_limit` holds every permit with blob reads and asserts both commit reads wait until one is released. - `collab::git_tests::test_show_rpcs_are_routed_by_revision_kind_on_host` has a guest send `GitShow` with a sha and with a ref name while the host queue is held; the sha is answered, the ref name waits. Green: `cargo test -p project --lib git_store` (22), `cargo test -p git_ui --lib` (157), `cargo test -p collab --test collab_tests git_tests` (13), `./script/clippy`. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments — none added - [x] The content adheres to Zed's UI standards — no UI changes - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Showcase Five-commit repository with a remote that holds every fetch for ten seconds. Fetch is clicked, then commits in the History tab. **Before** https://github.com/user-attachments/assets/6c79f870-62cd-487b-be9f-7eefbb52b008 **After** https://github.com/user-attachments/assets/30680d1d-f19f-4407-90bf-11054ff3dd69 --- Release Notes: - Fixed commit details and diffs waiting behind an in-progress fetch, pull, or push before opening |
||
|
|
975845875b |
language_model: Make LanguageModel plain data served by its provider (#64750)
`LanguageModel` used to be a trait object. Each provider implemented it
on a private struct that bundled the model's metadata with the client,
credentials, rate limiter and a snapshot of its config, and consumers
held `Arc<dyn LanguageModel>` or a `ConfiguredModel { provider, model }`
pair.
This makes `LanguageModel` plain data: a `Clone + Debug + PartialEq`
struct with the same getters the trait had, held by value everywhere.
`ConfiguredModel` is gone. Providers serve requests themselves:
`LanguageModelProvider` gains `stream_completion` (plus the text/tool
helpers, `count_input_tokens`, `compact` and `api_key`), each taking
`&LanguageModel`. Senders look the provider up with
`LanguageModelRegistry::provider_for_model` when they send.
Every provider now has one lookup that decides which models it offers
and with what config. `provided_models` and the defaults are built from
it, and each request resolves the model's current config from it by id.
There are no per-model or per-request objects. A model the provider no
longer offers fails with a new, non-retried
`LanguageModelCompletionError::ModelUnavailable` instead of being served
from a stale snapshot.
This prepares for opening provider-side sessions over an append-only
message log. With models as plain data and requests on the provider, a
session can be one generic type rather than one per provider, and
deciding whether a session can be reused becomes a value comparison.
## Suggested reading order
1. `crates/language_model/src/language_model.rs` (the struct and
provider trait), `registry.rs`, and `fake_provider.rs`.
2. One representative provider:
`crates/language_models/src/provider/anthropic.rs`.
3. Providers that deviate: `bedrock.rs`, `llama_cpp.rs`,
`open_router.rs`, `crates/copilot_chat`, `crates/language_models_cloud`,
`crates/openai_subscribed`, `crates/x_ai_subscribed`.
4. Callers: `crates/agent/src/thread.rs`, then `agent_ui`, `git_ui`,
`sidebar`. Most of the remaining diff is tests.
## Behavior changes worth reviewing
- Rate limiting is one concurrency limit per model id, shared across the
app, with a limit of 16. Before, each model instance had its own limit
of 4.
- `Thread::refresh_model` re-selects a thread's model by id when its
provider reports a state change, so capability changes (for example a
llama.cpp model finishing loading) reach the thread.
- Bedrock resolves auth once per request for both Converse and Mantle,
off the foreground thread, with the SDK's default 5s credential load
timeout. Expiring credentials (SSO, STS, credential processes) are
cached until shortly before expiry and dropped on any auth change;
credentials without an expiry are re-read every request, so credential
files rewritten by external tools take effect immediately. Mantle
credential resolution now goes through Zed's HTTP client, like Converse.
- Bedrock honors `AWS_BEARER_TOKEN_BEDROCK`, then `AWS_BEARER_TOKEN`
(even if empty), over AWS credentials unless an API key is configured in
Zed, matching the SDK. This now applies to Mantle too, so users with
IAM/profile auth and one of these variables set must unset it (not empty
it) for Mantle to use IAM/profile.
- A Bedrock Mantle model with the same id as a Converse model replaces
it, so each id is offered and served once.
- OpenRouter and Vercel AI Gateway report default-model metadata from
the same lookup they serve requests from.
- A request for a model that has left a provider's list (for example
after signing out of Copilot or Zed) returns `ModelUnavailable`. Commit
message generation shows this as an error instead of doing nothing.
## Tests
`FakeLanguageModel` is gone. `FakeLanguageModelProvider` serves any
model id and owns every request sent to it; tests answer a request by
naming its model (`send_last_text(&model, ...)`, `send_text(&model,
&request, ...)`), so requests to different models can't be confused.
Tested: `agent` (753 tests), `language_model`, `language_models`,
`language_models_cloud`, `copilot_chat`, `openai_subscribed` and
`x_ai_subscribed`, plus `cargo check --workspace --tests`. The
`agent_ui`, `git_ui` and `sidebar` test binaries type-check but were not
run locally because of a linker issue in my environment; CI will cover
them. Providers have not yet been exercised against live services.
Release Notes:
- N/A
|
||
|
|
adc8d7918e |
git_ui: Add context menu to folders in tree view (#59853)
# 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> |
||
|
|
6990d3f678 |
git_ui: Fix missing language injections in historical file buffer (#64683)
Buffers built for the commit view (git history -> open excerpts) were assigned a language without attaching the language registry, so injected grammars (Markdown-Inline, fenced code block languages) could not be resolved and their captures went unstyled. Attach the registry before assigning the language, matching the pattern in text_diff_view.rs, and add a regression test asserting that a buffer built via build_buffer parses with Markdown-Inline layers. Fixes #64577 # Objective - Describe the objective or issue this PR addresses. - If you're fixing a specific issue, use "Fixes #X" for each issue as [described in the GitHub docs](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword). ## Solution - Describe the solution used to achieve the objective above. ## Testing - Did you test these changes? If so, how? - Are there any parts that need more testing? - How can other people (reviewers) test your changes? Is there anything specific they need to know? - If relevant, what platforms did you test these changes on, and are there any important ones you can't test? ## Self-Review Checklist: - [x ] 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) - [ x] Tests cover the new/changed behavior - [x ] Performance impact has been considered and is acceptable ## Showcase > This section is optional. If this PR does not include a visual change or does not add a new user-facing feature, you can delete this section. - Help others understand the result of this PR by showcasing your awesome work! - If this PR includes a visual change, consider adding a screenshot, GIF, or video - A before/after comparison is very useful for changes to existing features! While a showcase should aim to be brief and digestible, you can use a toggleable section to save space on longer showcases: <details> <summary>Click to view showcase</summary> <img width="1170" height="831" alt="image" src="https://github.com/user-attachments/assets/56d948b0-b9da-42ec-abb2-3b19a7b38948" /> </details> --- Release Notes: - Fixed syntax highlighting for Markdown emphasis, links, and code blocks when viewing a file at a historical commit |
||
|
|
418f897148 |
Prevent multibuffer items from switching active repository (#58795)
Fixes the git panel's active repository being silently overridden by the cursor position in `ProjectDiff`. Closes #58792 Closes #61530 ## Summary When a multi-buffer item (e.g. `ProjectDiff`) gains focus, the workspace calls `set_active_repo_for_path` with the cursor's project path to automatically switch the active git repository. This was safe when multi-buffer items returned `None` from `active_project_path`, but PR #57236 changed `ProjectDiff` to return the cursor-based path (for project panel highlighting), inadvertently allowing the cursor position to override the user's explicit repository selection. Fix the issue by restoring the `Singleton` guard that was removed in PR #57236: only call `set_active_repo_for_path` when the active item is backed by a single buffer. ## Changes - **`workspace.rs`**: Only call `set_active_repo_for_path` when the active item's `buffer_kind` is `Singleton`. Multi-buffer items (e.g. `ProjectDiff`, diagnostics, search results) span multiple repositories, so their cursor position should not trigger an automatic repository switch. ## Before https://github.com/user-attachments/assets/6ca4fa61-b42a-447b-9de7-8b6ec1f1181a ## After https://github.com/user-attachments/assets/9b045ad9-2bb5-4862-ac45-41e9fdd3dc96 Closes #58792 Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed the Git panel unexpectedly switching repositories when viewing changes in multi-repository projects. --------- Co-authored-by: Kirill Bulatov <kirill@zed.dev> Co-authored-by: dino <dinojoaocosta@gmail.com> |
||
|
|
72b060af2e |
git_ui: Load diff buffers incrementally (#62536)
# Objective Opening a diff against a heavily drifted branch sits on a spinner until every changed file has loaded. Blob reads were serialized through the git job queue and enqueued in `open_buffer` completion order rather than path order, so the blob for the first excerpt could be hundreds of jobs deep. ## Solution 1. `load_blob_content` skips the job queue — blobs are content-addressed, so the read doesn't depend on the status snapshot. 2. `DiffBuffer::load` is a lazy future instead of an eagerly-spawned `Task`, so the consumer picks the concurrency. 3. `DiffMultibuffer` drives those loads through `buffered(16)`. All three are needed: dropping the queue without bounding forks thousands of `cat-file` processes, and bounding without dropping it still serializes. Trust handling is unaffected, since the untrusted-repo flags are applied in `GitBinary::build_command` rather than by the queue. Worth noting that `handle_get_blob_content` is remote-reachable, so a guest can now put up to 16 `cat-file` processes on the host instead of queueing them. ## Testing Added `project_diff::tests::test_excerpts_are_ordered_by_path`, which pins excerpt order to `PathKey` rather than to load completion order, using more files than the concurrency limit and several executor seeds. Green: `cargo test -p git_ui --lib` (131), `cargo test -p project --lib git_store` (11), `./script/clippy`. Not tested against a remote or collab project, which is where the `handle_get_blob_content` change actually matters. ### Numbers Zed repo against a base ~3000 commits back: 2346 changed files, 1794 with a blob at the merge base. Warm cache, one `cat-file` process per blob, best of two runs at each concurrency. | concurrency | total | per blob | speedup | |---|---|---|---| | 1 (previous behaviour) | 77.25s | 43.1ms | 1.00x | | 2 | 17.74s | 9.9ms | 4.35x | | 4 | 10.05s | 5.6ms | 7.69x | | 8 | 7.34s | 4.1ms | 10.52x | | 16 (this change) | 6.63s | 3.7ms | 11.65x | | 32 | 6.59s | 3.7ms | 11.73x | | 64 | 7.14s | 4.0ms | 10.82x | 16 is where the curve flattens: 32 buys another 0.7% and 64 regresses, so there's nothing above it worth the extra in-flight buffers or the extra concurrent processes on a host serving a remote peer. At one blob at a time the first excerpt waits at an arbitrary position in a 1794-deep queue, so roughly 38s on average, which lines up with the 45s full load in the recording below. It's now in the first batch. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments — none added - [x] The content adheres to Zed's UI standards — no UI changes - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Showcase Opening a branch diff against a base ~3000 commits back, 2346 changed files. Both clips are cut to 15s to keep the file size down — the before run took 45s to finish loading. **Before** https://github.com/user-attachments/assets/d9475de8-ddd3-48a0-99e2-042a2f655b42 **After** https://github.com/user-attachments/assets/0bf0e73d-0fac-4c2a-9749-71fee376f260 --- Release Notes: - Improved how quickly a branch diff shows its first changes when the branch has drifted a long way from its base |
||
|
|
a8535d86b7 |
language_model: Allow explicit prompt cache keys (#64460)
## Objective Related conversations can’t share an OpenAI cache key without also sharing a thread ID. We currently derive `prompt_cache_key` directly from `thread_id`, tying cache reuse to conversation identity. ## Solution Add an optional `prompt_cache_key` to `LanguageModelRequest` and use it in both OpenAI Chat Completions and Responses conversions. We still fall back to `thread_id` when no key is supplied, so existing callers keep their current behavior. This lets callers share a cache key across parent and child conversations while keeping their conversation and transport identities separate. ## Testing Added regression coverage for explicit keys, legacy fallback, provider capability gating, and serialization compatibility. ## Self-Review Checklist: - [x] 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 - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A |
||
|
|
aec7395e30 |
Fix cargo shear warnings (#64340)
Also updates CI to always run this - that way we ensure that disabling or enabling tests does not become stale at some point and thus can safely add this. Release Notes: - N/A - [GPUI] N/A |