Commit Graph
36135 Commits
Author SHA1 Message Date
Joseph T. Lyons 8311bec73b Remove past reviewer (#51767)
Release Notes:

- N/A
2026-03-17 16:34:35 +00:00
13daff6fe9 task: Expose current buffer language as $ZED_LANGUAGE variable (#51614)
Closes #12628

Adds a `$ZED_LANGUAGE` task variable that resolves to the language name
of the active buffer (e.g., "Rust", "Python", "Shell Script"). This lets
tasks adapt behavior based on language without parsing file extensions.

Use cases from the issue:
- Pass syntax highlighting language to external tools (e.g., `rg --type
$ZED_LANGUAGE`)
- Adjust comment wrapping width per language
- Handle extensionless files and untitled buffers that have a language
assigned

VS Code provides equivalent functionality via
`${command:activeEditorLanguageId}`. Neovim exposes it as `&filetype`.

## Changes

- Added `Language` variant to `VariableName` in
`crates/task/src/task.rs`
- Populated from `buffer.language().name()` in
`BasicContextProvider::build_context`
(`crates/project/src/task_inventory.rs`), following the same pattern as
`File` and `Stem`
- Updated test fixtures in `crates/tasks_ui/src/tasks_ui.rs` to include
the new variable
- Added `ZED_LANGUAGE` to the variable list in `docs/src/tasks.md`

## Testing

Updated the existing `test_task_variables` test in `tasks_ui` to verify
`ZED_LANGUAGE` resolves to "Rust" and "TypeScript" for the respective
test buffers.

This contribution was developed with AI assistance (Claude Code).

Release Notes:

- Added `$ZED_LANGUAGE` task variable that exposes the current buffer's
language name

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2026-03-17 18:04:04 +02:00
Ben Brandt ebafb3bca1 agent: Allow all settings in the thread to apply immediately (#51762)
Before we kind of had it mixed: you could change thinking but not model
etc. We brute forced a solution by disabling, but it seems better to
just allow all of them to be updated whenever we would build the
request.

Release Notes:

- N/A
2026-03-17 15:07:26 +00:00
Ben Brandt 8ceb87666c agent_ui: Only create ThreadHistory if agent supports it (#51759)
Rather than always having a ThreadHistory with an internal option,
changed it to be an Option<ThreadHistory> so we can better distingiuish
between an empty list and unsupported

Release Notes:

- N/A
2026-03-17 13:58:11 +00:00
Cameron Mcloughlin e76aaa2757 sidebar: Close all button (#51755) 2026-03-17 13:47:03 +00:00
Lena 9c580fe839 Add new guild member to PR autolabeler (#51753)
Release Notes:

- N/A
2026-03-17 12:49:59 +00:00
Ben Kunkle 3795b2ce9d Handle Linux FS Rescan Events (#51208)
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-17 07:48:44 -05:00
Smit Barmase 5f6b1739ae editor: Fix selection direction reversal in SelectLargeSyntaxNode with multiple cursors (#51752)
Closes https://github.com/zed-industries/zed/issues/47737

Regressed by https://github.com/zed-industries/zed/pull/27295

Release Notes:

- Fixed an issue where using the `SelectLargeSyntaxNode` action with
multiple cursors could reverse the selection direction for the last
cursor.
2026-03-17 12:35:50 +00:00
iam-liam 24dc1b13b6 Fix settings file restored to both panes after restart (#50842)
Closes #35947

## Summary

When a settings file was moved to a second pane and Zed restarted, the
file appeared in both panes. Closing it in one pane would close it in
the other.

## Root cause

`Editor::deserialize` restored standalone files (like settings.json) by
calling `workspace.open_abs_path()`, which routes through
`open_path_preview` → `pane.open_item()`, adding the editor to the
workspace's default pane. The caller (`SerializedPane::deserialize_to`)
then also adds the item to the target pane, so it ends up in two panes.

This also caused the SQL constraint violations @MrSubidubi noted: the
`items` table has `PRIMARY KEY(item_id, workspace_id)`, so the duplicate
triggers errors on the next serialisation cycle.

## Fix

Replace `workspace.open_abs_path()` with `project.open_local_buffer()`,
which opens the buffer without touching any pane. Pane placement is left
to `deserialize_to`.


https://github.com/user-attachments/assets/68d3c5b4-d002-429f-b907-ec21cb0019ec

## Test plan

- [x] Reproduced the original bug (settings file duplicated across panes
after restart)
- [x] Verified the fix: file restores only to the correct pane
- [x] Added regression test
(`test_deserialize_non_worktree_file_does_not_add_to_pane`)
- [x] Existing `items::tests::test_deserialize` passes (all 6 cases)
- [x] `cargo clippy -p editor` clean

Release Notes:

- Fixed settings file being restored to multiple panes after restart
  ([#35947](https://github.com/zed-industries/zed/issues/35947)).
2026-03-17 11:43:41 +00:00
Bennet Bo Fenner 0de04d4790 agent: Fix issue where created file is not deleted after rejecting (#51745)
Release Notes:

- N/A
2026-03-17 11:05:11 +00:00
Xiaobo Liu b26796f9c0 agent_ui: Fix send failure for pasted file#line mention links (#49786)
Release Notes:

- Fixed send failure for pasted file#line mention links


Handle `MentionUri::Selection` with a file path in
`confirm_mention_for_uri`
by resolving it to text content via existing line-range loading logic,
instead
of returning "Unsupported mention URI type for paste".

Keep untitled-buffer selections (`abs_path: None`) as an explicit
unsupported
error for now.

Add a regression test for pasting selection mentions to ensure they
resolve to
`Mention::Text` with the expected line range.

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
2026-03-17 10:56:00 +00:00
293ae8d897 vim: Fix Helix mode subword motions to select traversed text (#45760)
Update Helix's handling of the following actions in order to ensure that
selections are created when using subword motions:

* `vim::NextSubwordStart`
* `vim::NextSubwordEnd`
* `vim::PreviousSubwordStart`
* `vim::PreviousSubwordEnd`

The handling of these motions was done by
`vim::helix::Vim::helix_move_and_collapse`, which simply moved the
cursor without doing any selection. This commit updates it to correctly
use both `vim::helix::Vim::helix_find_range_forward` and
`vim::helix::Vim::helix_find_range_backward`.

The added tests have been confirmed against Helix's behavior of the following commands:

* `move_next_sub_word_start`
* `move_prev_sub_word_start`
* `move_next_sub_word_end`
* `move_prev_sub_word_end`

Closes #41767

Release Notes:

- Fix subword motions in Helix mode to select traversed text

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-03-17 10:49:01 +00:00
Casey WatsonandAmp b986e15791 Add remote hostname to title bar project picker tooltip (#51616)
Having multiple remote hosts with long project names makes the project
picker tricky to use.

Added the remote hostname to the tooltip to avoid guessing.

**truncated project + hostname (no change)**
<img width="426" height="368" alt="Screenshot 2026-03-15 at 12 16 29 PM"
src="https://github.com/user-attachments/assets/7b6b732e-cf3c-42c7-9912-1a69ee58b60e"
/>


**hostname in tooltip (multiline)**
<img width="495" height="366" alt="Screenshot 2026-03-15 at 12 16 56 PM"
src="https://github.com/user-attachments/assets/77b60b3a-b8c0-4088-b3c2-3c105a097720"
/>

**hostname in tooltip (single line)**
<img width="426" height="366" alt="Screenshot 2026-03-15 at 12 17 15 PM"
src="https://github.com/user-attachments/assets/baf4d4bd-2724-4a3e-ab29-39ff714fec0e"
/>


Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Add remote hostname to title bar project picker tooltip.

Co-authored-by: Amp <amp@ampcode.com>
2026-03-17 10:44:33 +00:00
bc03bce92a Use split token display for xAI models (#48719)
### Split token display for xAI

Extends the split input/output token display (introduced in #46829 for
OpenAI) to all xAI models.

Instead of the combined `48k / 1M` token counter, xAI models now show:
- **↑** input tokens used / input token limit
- **↓** output tokens used / output token limit

#### Before

<img width="513" height="128" alt="Screenshot 2026-02-08 at 11 07 13 AM"
src="https://github.com/user-attachments/assets/14e5cb4a-9b5c-4081-bbfb-407a737bf234"
/>


#### After

<img width="610" height="126" alt="Screenshot 2026-02-08 at 11 05 36 AM"
src="https://github.com/user-attachments/assets/92396dcb-8905-4f87-9b9e-d8b0f63225ba"
/>


#### Changes

- **x_ai.rs** — Override `supports_split_token_display()` to return
`true` on `XAiLanguageModel`. All built-in Grok models already implement
`max_output_tokens()`, so no additional plumbing was needed.
- **cloud.rs** — Add `XAi` to the `matches!` pattern in
`CloudLanguageModel::supports_split_token_display()` so cloud-routed xAI
models also get the split display.

#### Tests

- `test_xai_supports_split_token_display` — Verifies all built-in Grok
model variants return `true` for split token display.
- `test_xai_models_have_max_output_tokens` — Validates all built-in Grok
models report `max_output_tokens` that is `Some`, positive, and less
than `max_token_count` (required for the UI to compute the input token
limit).
- `test_split_token_display_supported_providers` — Confirms the cloud
provider match pattern includes `OpenAi` and `XAi` while excluding
`Anthropic` and `Google`.

Release Notes:

- Changed the display of tokens for xAI models to reflect the
input/output limits.

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-03-17 10:42:31 +00:00
little Kitchen 7aeb7419b3 ollama: Don't override model's default stop tokens (#48119)
## Summary

When no stop tokens are provided, Zed was sending an empty array
(`"stop": []`) to Ollama. This caused Ollama to override the model's
default stop tokens (defined in its Modelfile) with nothing, resulting
in models like rnj-1:8b generating infinitely with literal stop tokens
appearing in the output.

## Problem

Models with custom stop tokens in their Modelfile (like `<|eot_id|>` for
rnj-1:8b) would generate forever because:

1. Agent thread creates request with `stop: Vec::new()` (empty)
2. Ollama provider converts this to `stop: Some(vec![])`
3. Serializes as `"stop": []` in JSON
4. Ollama interprets this as "override default stop tokens with nothing"
5. Model generates forever, outputting stop tokens as literal text

## Solution

1. In `crates/language_models/src/provider/ollama.rs`:
   - Only send `stop` when explicitly provided
   - When empty, use `None` so the field is omitted from JSON
   
2. In `crates/ollama/src/ollama.rs`:
- Add `#[serde(skip_serializing_if = "Option::is_none")]` to all
`ChatOptions` fields
   - Ensures `None` values are omitted, not serialized as `null`

## Testing

Added 4 new tests in `crates/ollama/src/ollama.rs`:
- `test_chat_options_serialization`: Verifies None fields are omitted
- `test_chat_request_with_stop_tokens`: Verifies stop tokens are
serialized when provided
- `test_chat_request_without_stop_tokens_omits_field`: Verifies empty
stop is omitted

All 11 ollama tests pass, plus 1 language_models ollama test.

Fixes #47798

Release Notes:

- Fixed Ollama models with custom stop tokens generating infinitely by
not overriding model defaults when no stop tokens are specified.
2026-03-17 10:39:54 +00:00
Elier 6c3c51acb9 Add stream_options.include_usage for OpenAI-compatible API token usage (#45812)
## Summary

This PR enables token usage reporting in streaming responses for
OpenAI-compatible APIs (OpenAI, xAI/Grok, OpenRouter, etc).

## Problem

Currently, the token counter UI in the Agent Panel doesn't display usage
for some OpenAI-compatible providers because they don't return usage
data during streaming by default. According to OpenAI's API
documentation, the `stream_options.include_usage` parameter must be set
to `true` to receive usage statistics in streaming responses.

## Solution

- Added StreamOptions struct with `include_usage` field to the open_ai
crate
- Added `stream_options` field to the Request struct
- Automatically set `stream_options: { include_usage: true }` when
`stream: true`
- Updated edit_prediction requests with `stream_options: None`
(non-streaming)

## Testing

Tested with xAI Grok models - token counter now correctly shows usage
after sending a message.

## References

- [OpenAI Chat Completions API -
stream_options](https://platform.openai.com/docs/api-reference/chat/create#chat-create-stream_options)
- [xAI API Documentation](https://docs.x.ai/api)
2026-03-17 10:38:14 +00:00
Ben Brandt 92b7e0885d agent: Save threads before closing them (#51744)
Closes #46078

When we unloaded sessions, we weren't necesarily making sure we had
saved the current state. Now we save it whenever we remove it from the
session map.

Release Notes:

- Agent: Fix cases where thread state wasn't saved before closing the
thread.
2026-03-17 10:26:06 +00:00
c58ab57a05 copilot: Clear completions upon discard (#40185)
Closes #37836

This behavior was already fixed for Supermaven in #37047, but is still
present in Copilot. What's actually happening:
- Receive a multi-line edit prediction
- Dismiss it with escape
- Clicking anywhere in the editor below the cursor calls
`Editor::select` which starts out by calling `Editor::hide_context_menu`
-> `Editor::update_visible_edit_prediction`, bringing back the
prediction that was just dismissed and updating the editor's display map
- The subsequent selection logic in `Editor::select` now operates using
a display map that is inconsistent with what the user saw when clicking
- If the click was anywhere where the prediction inlay used to be,
`Editor::select` thinks the user clicked on the inlay and does nothing,
and the inlay reappears
- If the click was below where the prediction inlay used to be, the
inlay is immediately removed again but the cursor is moved to the wrong
position because the inlay temporarily added a vertical offset to all
lines after it in the buffer

Ultimately, `Editor::select` should be handling the user input using the
same display map that the user saw when making the input. This can
obviously be solved in multiple ways, I chose to clear the current
completions in `CopilotCompletionProvider::discard` such that any
subsequent calls to `Editor::update_visible_edit_prediction` doesn't
immediately nullify the dismissal of the edit prediction by the user.

Note that this also changes the behavior that occurs after dismissing an
edit prediction, moving to a different position in the buffer, and then
returning: currently, this resurfaces the dismissed edit prediction
(which the `test_copilot` test exercises), and after this change it
doesn’t. This current behavior didn't seem desirable to me because it
doesn't happen when using Zeta or Supermaven, but if we want to keep it,
then we could fix the incorrect selection behavior some other way.

Release Notes:

- Fixed bug that resurfaced dismissed Copilot edit predictions when
moving the cursor around

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-03-17 09:59:17 +00:00
andrew j ef658992ef markdown_preview: Add ScrollToTop and ScrollToBottom actions (#50460)
Add `gg`/`G` (vim), `cmd-up`/`cmd-down` (macOS), and
`ctrl-home`/`ctrl-end` (Linux/Windows) keybindings to scroll to the top
and bottom of the markdown preview.

The markdown preview already has page scroll (`ctrl-d`/`ctrl-u`), line
scroll (`ctrl-e`/`ctrl-y`), and item scroll (`alt-up`/`alt-down`) but
was missing top/bottom navigation. This adds two new actions —
`ScrollToTop` and `ScrollToBottom` — using the existing
`ListState::scroll_to()` infrastructure, following the same pattern as
the other scroll actions.

- [x] Done a self-review taking into account security and performance
aspects

Release Notes:

- Added scroll-to-top and scroll-to-bottom keybindings for markdown
preview (`gg`/`G` in vim mode, `cmd-up`/`cmd-down` on macOS,
`ctrl-home`/`ctrl-end` on Linux/Windows)
2026-03-17 11:55:48 +02:00
Vinh Tran 48d8e31e68 Add deleted color to project panel (#51553)
When a file is deleted, the parent folder isn't colored which makes it
hard to know unless we look at the Git Panel.

This PR adds `Color::Deleted` to fix that.

<img width="366" height="428" alt="Screenshot 2026-03-14 at 7 56 04 PM"
src="https://github.com/user-attachments/assets/6ed3a3c7-e7e7-4b48-b89c-705a7c1ff634"
/>

Release Notes:

- Improved project panel to color folder with deleted file
2026-03-17 09:52:14 +00:00
Joey Carpinelli 7046308476 Add xcodebuild -runFirstLaunch fallback for Metal toolchain installation documentation (#51631)
When setting up on macOS 26, `xcodebuild -downloadComponent
MetalToolchain` can fail if Xcode hasn't been initialized yet. Running
`xcodebuild -runFirstLaunch` first resolves this.

Release Notes:

- N/A
2026-03-17 09:41:59 +00:00
Suphachai Phetthamrong b82e8b27e3 search: Fix project search tooltip keybinding hint disappearing (#51568)
What
---
The keybinding hint in the Project Search status bar button tooltip
disappears shortly after the tooltip appears, while the label "Project
Search" remains. This is most reproducible with no file open.

Why
---
`SearchButton` used `Tooltip::for_action` with no stored focus handle,
so `KeyBinding::render` called `window.focused(cx)` at render time to
resolve the `pane::DeploySearch` binding. When the `Tooltip` entity
re-rendered (it subscribes to theme settings changes) and the focused
element was no longer in a `Pane` key context, the keybinding lookup
failed silently and the shortcut hint vanished.

Fix
---
Store the active pane item's `FocusHandle` in `SearchButton` via
`set_active_pane_item` and use `Tooltip::for_action_in` so the
keybinding is always resolved against a stable `Pane` context. Falls
back to `Tooltip::for_action` when no pane item is active.

Closes #51562

Test Plan
---

- [x] `cargo fmt --check`
- [ ] `cargo test --workspace`
   - currently blocked by an unrelated compile error test 
- tests::test_terminal_kill_allows_wait_for_exit_to_complete ... FAILED
- [x] Manual verification of:
- Try to reproduce the issue and the keyboard shortcut visible for as
long as the cursor is hovering over the button.
   
Release Notes
- Fixed Project Search status bar button tooltip keybinding hint
disappearing while hovering

Screenshots
---
Current:
<img width="835" height="496" alt="image"
src="https://github.com/user-attachments/assets/cb1ffdf2-7733-47f6-9030-041459c2734c"
/>

Expected:
<img width="835" height="496" alt="image"
src="https://github.com/user-attachments/assets/84cb54b9-290c-4210-b86b-7ae9f8bf9ac0"
/>

Release Notes:

- N/A
2026-03-17 09:41:17 +00:00
Bennet Bo Fenner 7cbc752cab sidebar: Fix subagent threads showing up (#51739)
Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A
2026-03-17 09:29:37 +00:00
Ben Brandt b41b8dd7c6 agent_servers: Move agent_id constants to agent_servers crate (#51738)
Release Notes:

- N/A
2026-03-17 09:25:29 +00:00
Xin Zhao 881077b880 editor: Add an option to disable the formatter (#48991)
Related issue #48600, following #48904

Setting `"formatter": null` does not actually disable the formatter, as
it is functionally equivalent to leaving the setting undefined. In this
case, Zed falls back to the default behavior—either "auto" or a specific
language server, depending on the language.

This PR adds a "none" option to the formatter setting, allowing users to
explicitly disable formatting while keeping `code_actions_on_format`
enabled separately.
```json
"formatter": "none"
```

I still have some doubts about the necessity of this setting itself, but
if it is a desired addition, I will update the documentation
accordingly. If not, please feel free to close this PR.

- [x] Tests or screenshots needed?
- [x] Code Reviewed
- [x] Manual QA

Release Notes:

- Added `"formatter": "none"` in settings to explicitly disable the
formatter.
2026-03-17 09:14:00 +00:00
Kirill Bulatov 27740da2b0 Use proper coodrinates when dealing with runnable ranges (#51735)
Follow-up of https://github.com/zed-industries/zed/pull/51299
Closes ZED-5TK

Release Notes:

- N/A
2026-03-17 09:01:09 +00:00
João Soares c22fc3bd31 gpui_macos: Fix deadlock during re-entrant key status changes (#51035)
Closes #50151

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed a deadlock that froze the entire app when opening a new window
from a PopUp window or switching focus between multiple windows on
macOS.
2026-03-17 08:50:54 +00:00
Amaan 9a0a75ce73 project: Fix empty files not downloading from a remote project (#51571)
- check `content_size==0`
- entry is removed from `downloading_files`
- empty file is writte via `smol::fs::write(..., &[])`

this means the receiver handles the empty files completely as soon as
the State message arrives, without ever needing a Chunk that will never
come

Closes #51551

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [ ] No UI CHANGES


Release Notes:
- Fixed empty files not downloading from a remote project
2026-03-17 08:48:29 +00:00
Finn Eitreim 74e49e6c16 languages: Fix semantic tokens for Go (#51621)
Closes #51620

gopls requires more specific initialization for semantic tokens that
other language-servers for reasons that aren't entirely clear to me, it
is however a small fix to make it work. still trying to track down other
malfunctioning language servers in the semantic token realm, so if you
have suggestions let me know.

original behavior (on nightly v0.229):
<img width="1784" height="1123" alt="nightly_behavior"
src="https://github.com/user-attachments/assets/5d976b34-2720-425c-8617-800291862909"
/>

updated behavior:
<img width="1784" height="1124" alt="fix_applied"
src="https://github.com/user-attachments/assets/17c528b9-fea8-4309-9306-44673afc9fc3"
/>

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- gopls: fixed semantic token support with gopls.
2026-03-17 09:03:46 +01:00
Owen Law 6910d46704 gpui(web): Pass events to input handlers and handle IME composition (#50437)
Currently the web backend for gpui doesn't send any events to the
`InputHandler`'s like `EntityInputHandler` which are needed for the
input example and the editor crate, among others. This PR makes it pass
those events, in addition to also dealing with composition events so
that IME works. It adds an invisible input element to listen for
composition events, since canvases don't receive them.

Release Notes:

- N/A
2026-03-17 08:40:44 +01:00
ᴀᴍᴛᴏᴀᴇʀ b8fdab4283 lsp: Display readable gopls version in UI (#49835)
Closes #49757
|Before|After|
|--|--|
|<img width="2776" height="218" alt="CleanShot 2026-02-22 at 17 43
16@2x"
src="https://github.com/user-attachments/assets/1ea30418-b192-4a6f-ba11-41d5728a1645"
/>|<img width="814" height="232" alt="CleanShot 2026-02-22 at 17 42
21@2x"
src="https://github.com/user-attachments/assets/ac1637fa-1c97-47e2-90e7-00f68b58345f"
/>|

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed gopls version display showing raw JSON instead of readable
version number
2026-03-17 08:36:37 +01:00
Remco Smits 92627d54ec git_ui: Fix select previous selects a non-visible item (#49289)
This PR fixes that when you are below a header and want to select a
previous item, we would select a non-visible item because we did a -1 of
the newly selected index, which could end up inside a collapsed
directory.

**Note**: This is only an issue for the git tree view mode.

**Before** (See selection is not visible anymore after select previous,
because it's inside the collapsed directory)


https://github.com/user-attachments/assets/bd032768-b947-45f8-b5a1-6185010202cf

**After** (See selection now selects the first visible item in the list
which is the collapsed directory)


https://github.com/user-attachments/assets/47f67237-be7c-4ef5-8b99-6a3a2b016086

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Git UI: Fix selecting previous item would select a non-visible item if
it's inside a collapsed directory
2026-03-17 07:36:16 +00:00
iam-liamandBen Kunkle 7545f13740 keymap_editor: Fix default binding deletion and override (#50699)
## Summary

Fixes #48725

When using the keymap editor to delete or re-bind default keybindings,
two issues caused stale entries to persist:

- **Deleting a default binding** created a `NoAction` suppression entry
in `keymap.json` (correct for GPUI-level suppression), but the keymap
editor displayed it as a phantom `<null>` row alongside the greyed-out
default. Searching by keystroke showed both entries, and clash detection
counted the phantom as a real binding.

- **Changing a default binding's keystroke** (e.g. `⌥⌘T` → `⇧⌃⌘T`) added
the new binding but never suppressed the original default under the old
keystroke. The old default continued appearing in keystroke searches and
clash warnings.

## Fix

1. **Filter `NoAction` suppression bindings from the keymap editor
display.** These remain in the internal binding list for conflict
detection (so overridden defaults are still correctly greyed out), but
are excluded from the visible match results.

2. **Append a `null` suppression for the old keystroke when replacing a
non-user binding with a different keystroke.** When `update_keybinding`
converts a `Replace` to `Add` for a non-user binding and the keystroke
changes, it now also writes `{"old-keystroke": null}` (with the original
context) to suppress the stale default.

## Reproduction steps (verified fixed)

1. Open the keymap editor
2. Click Search by Keystroke and press `⌥⌘T`
3. You should see "agent: new thread" and "pane: close other items"
(both Default)
4. Right-click "agent: new thread" and choose Delete
5. Double-click "pane: close other items", change keystroke to `⇧⌃⌘T`,
click Save
6. Verify no `<null>` phantom row appears, and no stale defaults remain
under `⌥⌘T`
7. Close and reopen the keymap editor, search `⌥⌘T` — no results
8. Search for "editor: wrap selections in tag" and assign `⌥⌘T` — no
clash warnings

## Test plan

- [x] Existing `keymap_update` and `test_keymap_remove` tests pass
- [x] Added test: replacing a non-user binding **without** changing the
keystroke produces no suppression
- [x] Added test: replacing a non-user binding **with** context and
keystroke change produces a suppression that preserves the context
- [x] Manual verification of all reproduction steps above

Release Notes:

- Fixed an issue with the keymap editor where where the defaults would not be completely removed when deleting or overriding default keybindings

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
2026-03-17 04:56:48 +00:00
Richard Feldman ef91779eff Reject shell substitutions in terminal tool commands (#51689)
Harden the terminal tool's permission system to reject commands
containing shell substitutions and interpolations (`$VAR`, `${VAR}`,
`$(…)`, backticks, `$((…))`, `<(…)`, `>(…)`) before they reach terminal
creation.

## Changes

### Shell command parser (`shell_command_parser`)
- Added structured terminal command-prefix extraction with env-var
prefix support
- Added parser-backed validation that classifies commands as
Safe/Unsafe/Unknown
- Extended normalized command extraction to include scalar env-var
assignments in order
- Preserved quoted assignment values when they contain whitespace or
special characters

### Pattern extraction (`agent/pattern_extraction`)
- Updated terminal pattern extraction to use structured parser output
- Included env-var prefixes in generated allow patterns
- Normalized regex token boundaries to `\s+` while preserving display
whitespace

### Tool permissions (`agent/tool_permissions`)
- Added invalid-terminal-command rejection for forbidden
substitutions/interpolations
- Added unconditional allow-all bypass (global default Allow, or
terminal-specific Allow with empty patterns)
- Preserved hardcoded denial precedence over allow-all

### Terminal tool (`agent/tools/terminal_tool`)
- Updated tool description and input schema to explicitly prohibit shell
substitutions
- Added comprehensive SEC-264 regression test suite (20 new tests)
covering:
- All forbidden constructs (`${HOME}`, `$1`, `$?`, `$$`, `$@`,
`$(whoami)`, backticks, `$((1+1))`, `<(ls)`, `>(cat)`, env-prefix
variants, multiline, nested)
  - Allow-all exception paths (global and terminal-specific)
  - Hardcoded-denial precedence
- Env-prefix permission flow (matching, value mismatch rejection,
multiple assignments, quoted whitespace)

Closes SEC-264

Release Notes:

- Terminal tool permissions regexes can now match environment variables
(e.g. `FOO=bar cmd arg1 arg2`)
- If terminal tool permissions have active permissions regexes running
on them, then bare interpolations like `$FOO` are disallowed for
security, since regexes wouldn't be able to match on them.
2026-03-16 23:49:34 -04:00
Max Brunsfeld c62327044b Move sidebar back out of the panel (#51723)
Reverts https://github.com/zed-industries/zed/pull/51241

Release Notes:

- N/A
2026-03-17 03:48:20 +00:00
Ayush Kumar Anand 8eb019c2b7 Fix "Show Edit Predictions For This Buffer" button (#50845)
Closes #48393

When switching the language of an unsaved buffer (e.g., from Plain Text
to JavaScript), the editor's edit_prediction_settings were not
recalculated. This caused the "This Buffer" toggle in the edit
prediction menu to show a stale state, making the first click a no-op. I
added a call to update_edit_prediction_settings in the LanguageChanged
event handler so the editor immediately reflects the correct edit
prediction state for the new language.

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed the "Show Edit Predictions For This Buffer" toggle being a no-op
in unsaved buffers after switching the buffer's language.
2026-03-17 02:52:03 +00:00
Lee ByeongJun 9cea060d57 worktree: Fix binary files misdetected as UTF-16 (#50890)
Closes #50785

Opening a .wav file (PCM 16-bit) caused Zed to freeze because the binary
detection heuristic in `analyze_byte_contentmisidentified` it as
UTF-16LE text. The heuristic determines UTF-16 encoding solely by
checking whether null bytes are skewed toward even or odd positions. PCM
16-bit audio with small sample values produces bytes like `[sample,
0x00]`, creating an alternating null pattern at odd positions that is
indistinguishable from BOM-less UTF-16LE by position alone.

### Why not just add more binary headers?

The initial approach
(https://github.com/zed-industries/zed/commit/32d8bd700943ae7cb46231bc08d752d8b7987432)
was to add audio format signatures (RIFF, OGG, FLAC, MP3) to known
binary header. While this solved the reported `.wav` case, any binary
format containing small 16-bit values (audio, images, or arbitrary data)
would still be misclassified. Adding headers is an endless game that
cannot cover unknown or uncommon formats.

### Changes

* Adds `is_plausible_utf16_text` as a secondary validation: when the
null byte skew suggests UTF-16, decode the bytes and count code units
that fall in C0/C1 control character ranges (U+0000–U+001F,
U+007F–U+009F, excluding common whitespace) or form unpaired surrogates.
Real UTF-16 text has near-zero such characters. I've set the threshold
at 2% — note that this is an empirically derived value, not based on any
formal standard.

**Before fix**

<img width="1147" height="807" alt="스크린샷 2026-03-06 오후 9 00 07"
src="https://github.com/user-attachments/assets/2e6e47f9-f5e7-4cab-9d41-cc3dd20f9142"
/>

**After fix**
<img width="1280" height="783" alt="스크린샷 2026-03-06 오전 1 17 43"
src="https://github.com/user-attachments/assets/3fecea75-f061-4757-9972-220a34380d67"
/>


Before you mark this PR as ready for review, make sure that you have:
- [X] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed binary files (e.g. WAV) being misdetected as UTF-16 text,
causing Zed to freeze.
2026-03-17 02:51:44 +00:00
DongandBen Kunkle 0a3be91918 keymap_editor: Remove redundant parentheses when displaying keymap context (#50906)
Closes #34976

## Root Cause

The current implementation of `fmt::Display` in
`KeyBindingContextPredicate` hardcodes a parentheses around `And` and
`Or` cases. Causing the text displayed on the keymap editor to have
nested parentheses.

This PR refactors the display logic and make the parentheses added only
when there's nested operator.

## As is/ To be

As is | To be
--- | ---	
<img width="800" height="1101" alt="Screenshot 2026-03-06 at 15 07 10"
src="https://github.com/user-attachments/assets/33b4366d-4d16-48db-9cc6-b79d6cc7ddc7"
/> | <img width="800" height="977" alt="Screenshot 2026-03-06 at 14 54
57"
src="https://github.com/user-attachments/assets/3d5ed38d-949d-4265-8fad-e29250c3a285"
/>

## Test coverage

<img width="800" height="916" alt="Screenshot 2026-03-06 at 15 00 42"
src="https://github.com/user-attachments/assets/5846b908-5c86-48a7-919e-a7ae198484a8"
/>



Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- keymap_editor: Remove redundant parentheses when displaying keymap
context

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
2026-03-17 02:44:12 +00:00
Alejandro Fernández Gómez bc95e55403 Disable the tilt LSP by default for "Starlark" files (#51709)
This matches how the `buck2-lsp` works for that extension.

Fixes https://github.com/zaucy/zed-starlark/issues/18

Before you mark this PR as ready for review, make sure that you have:
- [ ] (n/a) Added a solid test coverage and/or screenshots from doing
manual testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A
2026-03-16 22:48:20 +00:00
Finn Evers f037e38b84 extension_ci: Bump update action and fix cache issues (#51716)
This PR bumps the update action again. It also fixes a bug where a cache
issue could occur during the extension auto bump and adds update
auto-merge for PRs from staff-members in zed-industries/extensions.

Release Notes:

- N/A
2026-03-16 22:26:56 +00:00
Ben Brandt 010001eb1b agent_ui: Remove special casing for previous built in agents (#51713)
Now that the migration has happened, we can stop making these ever
present

Release Notes:

- N/A
2026-03-16 22:25:04 +00:00
Ben Brandt 3ac459ab31 agent_ui: Fix non-compiling tests (#51715)
Release Notes:

- N/A
2026-03-16 22:12:30 +00:00
Richard Feldman ce7a0a1c65 Simplify New Worktree to only restore active buffer or fullscreen agent panel (#51700)
Dramatically simplifies what "New Worktree" does when forking a
workspace.

Previously we captured the entire dock structure and all open file
paths, then restored them all in the new worktree workspace. Now the
behavior is:

- If you have an active buffer open, we reopen just that one file (no
other buffer state is carried over).
- If you do not have an active buffer open, we instead fullscreen (zoom)
the agent panel (equivalent to cmd-esc).

No other workspace state is carried over.

Implementation details:
- Replace `capture_dock_state` / `set_dock_structure` /
`open_item_abs_paths` with a single `active_file_path` lookup.
- Pass `None` for the `init` closure instead of restoring dock layout.
- Only reopen the single active file via `open_paths`, with proper error
logging (`detach_and_log_err`) instead of silent `.detach()`.
- Emit `PanelEvent::ZoomIn` on the agent panel when no active buffer
exists, after `focus_panel` to ensure the panel is properly activated
first.
- Warn when an active file exists but cannot be remapped to the new
worktree.

Closes AI-87

Release Notes:

- N/A
2026-03-16 17:22:11 -04:00
Richard Feldman 184c062557 Preserve selected agent when starting thread in new worktree (#51628)
When the user selected a custom agent (e.g. Codex) and chose "Start
Thread in New Worktree", the new workspace's panel ignored the selection
and defaulted to Zed Agent (NativeAgent).

The fix captures `self.selected_agent()` in
`handle_worktree_creation_requested` before the async task, passes it
through to `setup_new_workspace`, and forwards it to `external_thread`
instead of `None`.

Closes AI-84

(No release notes because it's still feature-flagged.)

Release Notes:

- N/A
2026-03-16 17:10:50 -04:00
morgankrey 0fa7b84c54 docs: Update Claude Sonnet 4.6 and Opus 4.6 context windows to 1M (#51695)
## Summary

- Update the context window table in `models.md` to reflect that Claude
Sonnet 4.6 and Opus 4.6 now support 1M token context windows (previously
listed as 200k)
- Remove Sonnet 4.5/4.6 from the "may increase in future releases"
callout since the 4.6 models are now at 1M

Release Notes:

- N/A
2026-03-16 13:34:20 -05:00
Bennet Bo Fenner 0e7d078338 agent_ui: Rename ConnectionView to ConversationView (#51684)
We now share connections across multiple "ConnectionView"s the naming
does not make sense anymore

Release Notes:

- N/A
2026-03-16 18:34:21 +01:00
Lukas Wirth 4122f23606 gpui: Fix hash collision panics in ProfilingCollector (#51683)
Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-16 18:10:31 +01:00
Karthik Nishanth 002bb34dbc editor: Go to previous and next symbol actions (#50777)
Closes discussion #34890 

This is similar to the vim prev/next method/section motion, but more
flexible because this follows the items in editor's outline (Tree sitter
or LSP provided).

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Added actions `editor::GoToPreviousSymbol` and
`editor::GoToNextSymbol` actions to go to the previous and next outline
symbol. This is either the tree sitter outline, or the LSP provided
outline depending on the configuration.
2026-03-16 19:01:28 +02:00
Bennet Bo Fenner 9c8d9871c1 agent_ui: Rename ConnectionView to ConversationView (#51684)
We now share connections across multiple "ConnectionView"s the naming
does not make sense anymore

Release Notes:

- N/A
2026-03-16 16:33:12 +00:00
Lukas Wirth 86ad360ac6 editor: Fix panic in refresh_inline_values when spanning cross excerpts (#51685)
Fixes ZED-5VQ

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-16 16:30:27 +00:00