mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-20 07:30:22 +01:00
ead5672e169f4d4ec0a6a88ebac18e00a37bf81b
976 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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 |
||
|
|
59d996d8db |
Add per-request model output limits (#64047)
## Stack - This PR: output-limit plumbing, based on `main`. - #64194: provider input counting and consent, based on this branch. - #64195: Copilot metadata and consumers, independently based on this branch. After this PR lands, rebase/retarget both children onto `main` as needed, especially after a squash merge. At split time, a synthetic merge of the two child heads exactly matched the saved pre-split source tree. PR1 has since consolidated overlapping tests without changing production code. ## Summary Part 1 of a three-PR split: add optional per-request `max_output_tokens`, forward it through provider payloads, and clamp it against known output limits. Unset requests preserve existing defaults. Unknown Copilot output metadata is not treated as a zero-token maximum when forwarding a cap. This PR also supplies the combined-window and native-capability interfaces used by downstream budget calculations. It does not add input-token counting, data-retention consent integration, or change Copilot prompt/context metadata, compaction thresholds, or tooltips. Those changes are split into two child PRs based on this branch. The net diff is 24 files, +438/-55. Forward narrowing commits preserve the original review history; there was no force-push. ## Test consolidation Eight overlapping standalone tests have been folded into existing conversion tests, preserving coverage of unset limits, explicit limits, clamping, and serialized payloads. Four distinct tests remain separate: request serialization compatibility, Copilot wire formats, DeepSeek conversion (no existing conversion suite), and hosted OpenAI normal-completion HTTP behavior. This cleanup changes no production Rust code. ## Validation - Latest run: 269 tests passed across anthropic, google_ai, open_ai, language_models, copilot_chat, and language_models_cloud. - Five extended existing tests failed when cap selection was temporarily broken and passed after restoration. No mutations remain. - Latest scoped script/clippy, formatting, and whitespace checks passed. Earlier split validation: - 229 tests passed across language_model_core, anthropic, open_ai, copilot_chat, and language_models_cloud. - Scoped script/clippy passed for copilot_chat, language_models_cloud, language_models, agent, and agent_ui. - Formatting and whitespace checks passed. - Permanent tests cover payload propagation, absent/explicit limits, unknown output metadata, direct and hosted native-compaction caps, and hosted OpenAI clamping. - No live provider requests were made for the split. ## Review notes The separately identified fixed/non-interleaved thinking-budget versus smaller output-cap concern remains open in this PR; it must not be hidden in the counting or metadata PRs. The README acknowledgment is retained for human review. Downstream applications using input counting must consume the counting child PR as well, not repin to this branch alone. Release Notes: - N/A |
||
|
|
47b8ea5894 |
Reveal in all multi buffers (#64154)
Closes https://github.com/zed-industries/zed/issues/62909 Closes https://github.com/zed-industries/zed/issues/57396 Release Notes: - Fixed project panel reveal not working in git diff-related multi buffers |
||
|
|
bf921d03b8 |
git_ui: Add clipboard context menu to commit message editor (#64142)
# Objective - Enable users to cut, copy, and paste commit-message text through a right-click menu in the Git sidebar and expanded commit modal. ## Solution - Add a context menu to the shared commit-message editor using Zed’s existing clipboard actions - Disable Cut and Copy when no text is selected, and route actions to the editor’s focus handle. ## Testing - Added a regression test covering clipboard behaviour in both editor modes. - Reviewer can test by using right-click context menu in the git commit message panel to cut/copy/paste - Tested on Mac OS with `cargo run` ## 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="800" height="451" alt="commit-menu" src="https://github.com/user-attachments/assets/1ba281d7-7651-4408-8c10-ee456cde2e1d" /> --- Release Notes: - Added Cut, Copy, and Paste context menu actions to the commit message editor. |
||
|
|
6fff327a90 |
Bump Rust to 1.98.1 (#63010)
# Objective - Bump Rust to 1.98.1 Release Notes: - N/A |
||
|
|
5bdfa7c8ab |
ui: Fix modifier key hints on macOS (#63807)
# Objective Fixes #63805 ## Solution change alt -> option! ## Testing I built it and saw. ## Self-Review Checklist: - [y] I've reviewed my own diff for quality, security, and reliability - [y] Unsafe blocks (if any) have justifying comments - [y] 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) - [n] Tests cover the new/changed behavior (no behavior change) - [y] Performance impact has been considered and is acceptable ## Showcase <img width="258" height="52" alt="image" src="https://github.com/user-attachments/assets/73c215d2-dbf6-4eb7-9a96-7ef082d2be8d" /> --- Release Notes: - Fixed hints for branch and worktree deletion, keybinding conflicts, and edit predictions referring to Alt instead of Option on macOS. --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|
|
ab7afbff39 |
panel: Remove unused panel crate (#63742)
# Objective remove unused crate ## 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 --- Release Notes: - N/A --------- Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com> Co-authored-by: MrSubidubi <finn@zed.dev> |
||
|
|
ed8d600464 |
Add a history list key context to the Git panel (#63689)
# Objective The Git Panel exposes the `ChangesList` key context while its list is focused, including when the History tab is active. This causes Changes-only keybindings to match in History and provides no context for History-specific bindings. This is a fresh submission of the revised change from #63669, as requested in that PR's discussion. Fixes #61012 ## Solution Select the list key context from the active Git Panel tab. Changes exposes `ChangesList`, while History exposes `HistoryList`. The shared `GitPanel` and `menu` contexts remain unchanged. Preserve compatible keyboard behavior by sharing navigation, confirmation, and cancellation bindings between `ChangesList` and `HistoryList` on macOS, Linux, Windows, and Vim. File, staging, restore, and commit-editor bindings remain exclusive to `ChangesList`. Extend the dispatch-context test to verify that the list contexts are mutually exclusive and absent while the commit editor is focused. ## Testing - `cargo fmt --package git_ui -- --check` - `./script/check-keymaps` - `git diff --check` - `cargo test -p git_ui test_dispatch_context_with_focus_states -- --nocapture` - `cargo test -p git_ui` (153 passed) - `cargo build -p zed` - Manually verified on macOS that History reports `HistoryList` without `ChangesList`, arrow navigation selects commits, and Enter opens the selected commit - Linux and Windows keymaps were updated and checked, but not manually exercised on those platforms ## 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 The Keyboard Context view shows `GitPanel`, `menu`, and `HistoryList` while the History tab is focused. `ChangesList` is absent.  --- Release Notes: - Fixed Git Panel keybindings matching the Changes tab while the History tab is active. |
||
|
|
e621c4f441 |
git_ui: Fix git::FileHistory action in diff views (#63539)
# Objective
The `git::FileHistory` action ("View File History") silently does
nothing when a diff view is the active item (single-file or multibuffer
project diff).
## Solution
Diff views wrap their inner `Editor` and expose it via `act_as`, but
`resolve_file_history_target` used a strict `active_item_as::<Editor>`
downcast, which returns `None` for these wrappers. Resolve through
`act_as` instead.
## Testing
Added a regression test which opens a `ProjectDiff`, dispatches
`git::FileHistory`, and asserts the file's history graph opens. I've
verified it fails without the `act_as` fix, and confirmed the fix
manually (see Showcase).
## 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
Left is before, right is after:
https://github.com/user-attachments/assets/39972bdf-b24f-4583-afd7-d6eb5226f50f
---
Release Notes:
- Fixed viewing a file's Git history when in a diff view.
|
||
|
|
33375c34b9 |
git_graph: Show time in commit details (#62679)
# Objective The Git Graph list shows the full commit timestamp in its constrained date column, while the more spacious commit details view only shows the calendar date. Include the time in the details view so it does not provide less information than the graph itself. ## Solution Reuse the existing `format_timestamp` helper from the Git Graph `Date` column when rendering the selected commit details. This gives both views the same local date and time format without a separate formatting path. ## Testing - `cargo check -p git_ui` ## 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 --- Release Notes: - Improved Git Graph commit details to show the same full commit timestamp as the `Date` column. Co-authored-by: Kirill Bulatov <kirill@zed.dev> |
||
|
|
c3cf80c0d1 |
git_ui: Fix 'Go Back' skipping the Git Graph view (#63597)
# Objective - "Go back" behaved inconsistently when navigating from the Git Graph view: opening a commit diff (double-click on a commit) and then using "Go Back" would not return to the Git Graph — instead it jumped to whatever file was open before the Git Graph was opened. - Fixes #63293 ## Solution - `GitGraph`'s `Item` implementation never hooked into the pane's navigation history (missing `deactivated` / `set_nav_history`), unlike every sibling diff view (`CommitView`, `ProjectDiffEditor`, `MultiDiffView`, `BranchDiff`). Because of this, when a commit diff was opened on top of it, deactivating Git Graph never pushed an entry onto the pane's back-stack, so "Go Back" skipped straight past it to the previously active file. - Added a `nav_history: Option<ItemNavHistory>` field to `GitGraph` and implemented `set_nav_history`/`deactivated` to push a nav-history entry when the Git Graph tab is deactivated, matching the pattern used by other `git_ui` diff views. ## Testing - Added `test_go_back_from_commit_view_returns_to_git_graph` in `crates/git_ui/src/git_graph.rs`, which opens a file, then Git Graph, then a commit diff, and asserts that `Pane::navigate_backward` returns to the Git Graph view rather than the file. - Verified the test actually catches the regression by temporarily reverting the fix and confirming the test fails, then restoring the fix and confirming it passes. - `cargo test -p git_ui --lib git_graph::` — all 28 tests pass. - `./script/clippy -p git_ui` — clean, no warnings. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [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 <details> <summary>Click to view showcase</summary> Open the Git Graph and double click on any commit to see the details, after that press go back button, it should return to the Git Graph instead of previos opened file. https://github.com/user-attachments/assets/15f659a7-a60b-4d43-ad59-8be69a94cb31 </details> --- Release Notes: - Fixed "Go Back" not returning to the Git Graph view after opening a commit diff |
||
|
|
dbfeae7735 |
Ensure stale git commit template are not persisted (#63604)
## Objective Fixes #63478 Git commit templates were being persisted as pending commit message drafts. As a result, if the commit template changed, the previously applied template could be restored after restarting Zed instead of loading the updated template. ## Solution Do not persist the active commit message buffer as a draft when its contents exactly match the currently applied commit template. This preserves the existing behavior for genuine user drafts while allowing the current commit template to be loaded when the panel is restored. ## Testing Added tests covering: * Applying a new commit template after the template changes and the panel is restored. * Preserving a user-edited commit message when the commit template changes. Validated with: * `cargo test -p git_ui -- test_commit_template_applied_fresh_after_template_file_change test_user_draft_preserved_when_template_changes --nocapture` * `cargo fmt -p git_ui` * `cargo check -p git_ui` * `cargo test -p git_ui --lib` * `cargo clippy -p git_ui --tests -- -D warnings` ## 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: - Fixed stale git commit templates being restored as pending commit message drafts. --------- Co-authored-by: MrSubidubi <finn@zed.dev> |
||
|
|
229450844d |
git: Move diff hunk operations onto buffer diffs (#63556)
# Objective Keep Git-specific diff-base knowledge in `GitStore`, where Git operations are defined. Related to FR-135. ## Solution Give each `BufferDiff` its supported hunk operations. Keep editor hooks limited to rendering custom controls. ## 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 --- Release Notes: - N/A |
||
|
|
f8c278352f |
git_ui: Add multi-select to git panel for bulk stage, unstage, and discard (#60340)
Closes #26430 Complements: #52935 by Jacob Binnie Enables multi-select in the Git Panel, following the Project Panel rules. https://github.com/user-attachments/assets/2892c1e2-3071-47f9-af1a-48e1c69dbb8a **Core selection gestures:** 1. Click one file, shift+click a file deeper in the list: all files between highlight. 2. Click one file, then ctrl/cmd+click another file: it joins the selection; or removes it when selected. 3. Shift+down extends the selection from the current row; shift+up shrinks it back and re-extends past the anchor. 4. Escape with a selection clears it and keeps focus; Escape again toggles focus as before. 5. Plain click collapses selection to file and opens its diff; double-click triggers the alternate open action. 6. Shift+click on a checkbox still performs the pre-existing range staging. **Bulk operation gestures:** 1. Select multiple files, press space: if any member is unstaged, all become staged; press space again: all unstaged. 2. Right-click a file inside the selection: menu reads Stage/Discard/Trash N files, depending on context. 3. Select multiple files, press delete: confirmation prompt. Mixed selections: untracked = trashed, staged = unstaged. **Folders, in tree view:** 1. Ctrl/cmd+click a folder row behaves like its checkbox does: selects it as a unit, expands operations to descendants. 2. Folder rows inside a shift range join the selection. A collapsed folder is selected including its hidden files. 3. The same directory under Tracked and Untracked is two independent selections (so marks are section-qualified). 5. Plain click on a folder still expands/collapses it and clears the selection. **Implementation notes:** 1. Selection is stored as repo paths plus section-qualified tree keys to survive status refreshes.* 2. Stale entries are pruned on rebuild, selection is cleared on active repository change. 3. Range selection follows visual order in both flat and tree view. 4. Bulk operations batch into a single git operation. \* Not sure if this is the best option for storing it. **Why this is necessary** - Multi-select has been an ongoing feature wish since 2025 with various upvotes - Current state of the art IDEs offer this (VSCode, IntelliJ, VS) - It greatly increases efficiency using the diff panel **Why is the PR from #52935 not enough?** This PR builds on its approach. Thanks to @jacobbinnie. But I noticed a few things: - never clears the selection when the active repository changes - a failed checkout or trash disappears silently - hardcodes single-click = project diff and double-click = file diff, ignoring the entry_primary_click_action setting - its context menu still reads "Stage File" / "Discard Changes" (singular) - discard prompt always says "Discard" even for an all-untracked selection that will actually trash files - no shift+arrow range extension, no Escape to clear - it skips directory rows entirely, in tree view you can't act on a folder's subtree at all - its range_select only ever accumulates, consecutive shift+clicks grow the set and nothing shrinks it - Uses Vec<RepoPath> on marks, linear contains scans -> This PR uses HashSets, relevant for huge repos. - doesn't ship any tests -> This PR covers the whole range with tests too* \* Tests dominate this PR (~850 lines). The actual feature sits around 400. Release Notes: - Added multi-select to the git panel --------- Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com> Co-authored-by: Jacob Binnie <jacob.b@linktr.ee> Co-authored-by: Andrea Leone <andrealeone@hey.com> |
||
|
|
ff020dd053 |
git_ui: Batch merge conflict anchor resolution (#63394)
Improves merge-conflict loading by resolving ordered conflict anchors with a single excerpt sweep instead of restarting the excerpt scan four times per conflict. The pull request also adds `script/generate-merge-conflict-benchmark`, which creates validated small, medium, or severe repositories with real unresolved Git merges. On the severe workload (128 files × 256 conflicts), anchor conversion decreased from 483.5 ms to 5.9 ms, saving about 478 ms, or roughly 5% of the total refresh. Closes https://linear.app/zed-industries/issue/FR-174/improve-git-panel-performance-for-large-merge-conflicts ## Testing - `cargo test -p multi_buffer test_ordered_buffer_anchor_ranges_to_anchor_ranges` - `cargo test -p git_ui conflict` - `./script/clippy -p multi_buffer -p git_ui` - Generated and validated the small synthetic merge-conflict workload Release Notes: - Improved performance when opening large merge conflicts |
||
|
|
24254879b7 |
Stop re-resolving editorconfig sections on every language settings lookup (#63323)
Closes https://github.com/zed-industries/zed/issues/59689
Symbolicating the reporter's profile (21s of typing, Windows) showed
`Window::draw` taking 63% of the main thread at ~62 redraws/s (p95 draw
= 40ms), and 30.9% of the *entire* main thread inside
`EditorconfigStore::properties()`:
every `LanguageSettings` lookup — several per frame via
`DisplayMap::tab_size`, `MultiBuffer::language_settings`, indent guides,
and `LspStore::supports_range_formatting` — re-ran the full editorconfig
resolution (ancestor walk plus `ec4rs::Section::apply_to` over every key
of every section) and then cloned the whole `LanguageSettings` struct.
Real-world `.editorconfig` files carry hundreds of irrelevant keys
(`dotnet_*`, `ij_*`, ...), so the per-call map assembly dominated:
`RtlAllocateHeap` 7.3%, `memcmp` 7.0%, `memcpy` 6.6%,
`Properties::find_idx` 5.9% self time.
## Commit 1: resolve only the editorconfig properties Zed reads
- `EditorconfigStore::properties()` now applies only the 7 keys Zed
consumes (`indent_style`, `indent_size`, `tab_width`, `end_of_line`,
`max_line_length`, `insert_final_newline`, `trim_trailing_whitespace`)
instead of materializing every key of every matching section.
- Worktrees with no editorconfig at all now return `None` early instead
of allocating an empty `Properties` and forcing a `LanguageSettings`
clone on every lookup.
- Adds an `editor_render_with_editorconfig` benchmark: maximized window,
file-backed buffer at `src/app/components/editor_pane.ts`, a root
`.editorconfig` shaped after [the second
report](https://github.com/zed-industries/zed/issues/59689#issuecomment-5475124891)
(no `root = true`, a `[*]` section with ~3200 keys, 25 sections with
large `{...}` alternation lists) plus a 4-level nested chain, and a
typing workload (insert/delete + cursor moves).
```
main (
|
||
|
|
8166e3d7b8 |
Add folder_indicator setting to show chevron and folder icon together (#62393)
# Objective - Enable panels to show chevron and icon at the same time. - Closes #8661 ## Solution - Replaces `folder_icon` with a new `folder_indicator` which converts from a boolean to enum (`both`, `chevron`, `icon`) for the three display cases ## Testing - gpui and migration tests had been applied ## 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 ### project panel both | chevron | icon --- | --- | --- <img width="400" alt="both_project_panel" src="https://github.com/user-attachments/assets/4c21e1a1-a7a4-4471-b7de-fe867373ddbd" /> | <img width="400" alt="chevron_project_panel" src="https://github.com/user-attachments/assets/a626a82e-e5b7-470d-9d93-ed5787dc83d6" /> | <img width="400" alt="icon_project_panel" src="https://github.com/user-attachments/assets/20f9c55e-87c4-477a-b4c9-b070d6e5a1db" /> ### git panel both | chevron | icon --- | --- | --- <img width="400" alt="both_git_panel" src="https://github.com/user-attachments/assets/3dc166dd-9e63-4943-b803-df3f167876b6" /> | <img width="400" alt="chevron_git_panel" src="https://github.com/user-attachments/assets/8dfd2c10-3a68-439a-8019-4951b72e17d1" /> | <img width="400" alt="icon_git_panel" src="https://github.com/user-attachments/assets/d78a9938-91e7-4d39-a3c8-04647da67768" /> ### outline panel both | chevron | icon --- | --- | --- <img width="400" alt="both_outline_panel" src="https://github.com/user-attachments/assets/1b58c679-0bea-4600-a8ac-e800b0e8d24c" /> | <img width="400" alt="chevron_outline_panel" src="https://github.com/user-attachments/assets/0a9358e4-ec89-40d8-8d5e-a53b784ed30a" /> | <img width="400" alt="icon_outline_panel" src="https://github.com/user-attachments/assets/d8bf5199-5a8c-4de0-b516-00247e6531a5" /> --- Release Notes: - Added a `folder_indicator` setting that can show the disclosure chevron and folder icon at the same time in the project, outline, and git panels. --------- Co-authored-by: Kirill Bulatov <kirill@zed.dev> |