Commit graph

4152 commits

Author SHA1 Message Date
张小白
fff0ecead1
windows: Fix keystroke & keymap (#36572)
Closes #36300

This PR follows Windows conventions by introducing
`KeybindingKeystroke`, so shortcuts now show up as `ctrl-shift-4`
instead of `ctrl-$`.

It also fixes issues with keyboard layouts: when `use_key_equivalents`
is set to true, keys are remapped based on their virtual key codes. For
example, `ctrl-\` on a standard English layout will be mapped to
`ctrl-ё` on a Russian layout.


Release Notes:

- N/A

---------

Co-authored-by: Kate <kate@zed.dev>
2025-08-27 03:24:50 +08:00
Max Brunsfeld
d43df9e841
Fix workspace migration failure (#36911)
This fixes a regression on nightly introduced in
https://github.com/zed-industries/zed/pull/36714

Release Notes:

- N/A
2025-08-26 00:27:52 +00:00
Kirill Bulatov
65de969cc8
Do not show directories in the InvalidBufferView (#36906)
Follow-up of https://github.com/zed-industries/zed/pull/36764

Release Notes:

- N/A
2025-08-25 21:16:37 +00:00
Aleksei Gusev
11545c669e
Add file icons to multibuffer view (#36836)
<img width="1988" height="1420" alt="multi-buffer-icons-git-diff"
src="https://github.com/user-attachments/assets/48f9722f-ca09-4aa7-ad7a-0b7e85f440d9"
/>

Unfortunately, `cargo format` decided to reformat everything. Probably,
because of hitting the right margin, no idea. The essence of this change
is the following:

```rust
.map(|path_header| {
    let filename = filename
        .map(SharedString::from)
        .unwrap_or_else(|| "untitled".into());
    let path = path::Path::new(filename.as_str());
    let icon =
        FileIcons::get_icon(path, cx).unwrap_or_default();
    let icon = Icon::from_path(icon).color(Color::Muted);

    let label = Label::new(filename).single_line().when_some(
        file_status,
        |el, status| {
            el.color(if status.is_conflicted() {
                Color::Conflict
            } else if status.is_modified() {
                Color::Modified
            } else if status.is_deleted() {
                Color::Disabled
            } else {
                Color::Created
            })
            .when(status.is_deleted(), |el| el.strikethrough())
        },
    );

    path_header.child(icon).child(label)
})
``` 

Release Notes:

- Added file icons to multi buffer view
2025-08-24 18:57:12 +02:00
Kirill Bulatov
d24cad30f3
Be more lenient when dealing with rust-analyzer's flycheck commands (#36782)
Flycheck commands are global and makes sense to fall back to looking up
project's rust-analyzer even if the commands are run on a non-rust
buffer. If multiple rust-analyzers are found in the project, avoid
ambiguous commands and bail (as before).

Closes #ISSUE

Release Notes:

- Made it possible to run rust-analyzer's flycheck actions from anywhere
in the project
2025-08-22 22:55:50 +00:00
Finn Evers
e6267c42f7
Ensure pane: swap item right does not panic (#36765)
This fixes a panic I randomly ran into whilst mistyping in the command
palette: I accidentally ran `pane: swap item right`in a state where no
items were opened in my active pane. We were checking for `index + 1 ==
self.items.len()` there when it really should be `>=`, as otherwise in
the case of no items this panics.

This PR fixes the bug, adds a test for both the panic as well as the
actions themselves (they were untested previously). Lastly (and mostly),
this also cleans up a bit around existing actions to update them with
how we generally handle actions now.

Release Notes:

- Fixed a panic that could occur with the `pane: swap item right`
action.
2025-08-22 23:28:55 +02:00
Lukas Wirth
72bd248544
editor: Fix multi buffer header context menu not handling absolute paths (#36769)
Release Notes:

- N/A
2025-08-22 18:49:12 +00:00
Kirill Bulatov
42ae3301d0
Show file open error view instead of the modal (#36764)
Closes https://github.com/zed-industries/zed/issues/36672

Before:
either 
<img width="966" height="642" alt="image"
src="https://github.com/user-attachments/assets/7263ea3c-3d48-4f4d-be9e-16b24ca6f60b"
/>
(when opening from the project panel)

or

<img width="959" height="1019" alt="image"
src="https://github.com/user-attachments/assets/834041d4-f4d6-46db-b333-803169ec4803"
/>

(for the rest of the cases)

After:

<img width="2032" height="1167" alt="Screenshot 2025-08-22 at 19 34 10"
src="https://github.com/user-attachments/assets/1aa4530b-69f6-4c3a-8ea1-d4035dbb28da"
/>

(the unified error view)

Release Notes:

- Improved unsupported file opening in Zed

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-08-22 17:04:39 +00:00
Anthony Eid
8204ef1e51
onboarding: Remove accept AI ToS from within Zed (#36612)
Users now accept ToS from Zed's website when they sign in to Zed the
first time. So it's no longer possible that a signed in account could
not have accepted the ToS.


Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2025-08-22 11:45:47 -04:00
Kirill Bulatov
3d2fa72d1f
Make word completions less intrusive (#36745)
Introduce `min_words_query_len` threshold for automatic word completion
display, and set it to 3 by default.

Re-enable word completions in Markdown and Plaintext.

Release Notes:

- Introduced `min_words_query_len` threshold for automatic word
completion display, and set it to 3 by default to make them less
intrusive
2025-08-22 13:58:17 +00:00
Sarah Price
54df43e06f
Fix cursor movement in protected files on backspace/delete (#36753)
## Summary

Fixes cursor movement behavior in protected files (like Default
Settings) when pressing backspace or delete keys.

Previously, these keys would cause unwanted cursor movement instead of
being ignored as expected in read-only files.

## Changes

- Added read-only checks to `backspace()` and `delete()` methods in the
editor
- Consistent with existing pattern used by other editing methods
(`indent()`, `outdent()`, `undo()`, etc.)

## Test Plan

1. Open Default Settings in Zed
2. Place cursor at arbitrary position (not at start/end of file)  
3. Press backspace - cursor should remain in place (no movement)
4. Press delete - cursor should remain in place (no movement)

Fixes #36302

Release Notes:

- Fixed backspace and delete keys moving caret in protected files

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-22 13:18:46 +00:00
Smit Barmase
697a39c251
Fix issue where renaming a file would not update imports in related files if they are not open (#36681)
Closes #34445

Now we open a multi-buffer consisting of buffers that have updated,
renamed file imports.

Only local is handled, for now.

Release Notes:

- Fixed an issue where renaming a file would not update imports in
related files if they are not already open.
2025-08-21 20:19:17 +05:30
Cole Miller
1dd237139c
Fix more improper uses of the buffer_id field of Anchor (#36636)
Follow-up to #36524 

Release Notes:

- N/A
2025-08-21 09:24:34 -04:00
Cole Miller
f63d8e4c53
Show excerpt dividers in without_headers multibuffers (#36647)
Release Notes:

- Fixed diff cards in agent threads not showing dividers between
disjoint edited regions.
2025-08-21 13:23:56 +00:00
Sachith Shetty
68f97d6069
editor: Use highlight_text to highlight matching brackets, fix unnecessary inlay hint highlighting (#36540)
Closes #35981

Release Notes:

- Fixed bracket highlights overly including parts of inlays when
highlighting

Before -
<img width="1480" height="602" alt="Screenshot from 2025-08-19 17-15-06"
src="https://github.com/user-attachments/assets/8e6b5ed8-f133-4867-8352-ed93441fbd8b"
/>

After -
<img width="1480" height="602" alt="Screenshot from 2025-08-19 17-24-26"
src="https://github.com/user-attachments/assets/1314e54e-ecf9-4280-9d53-eed6e96e393f"
/>
2025-08-21 09:27:41 +03:00
Kirill Bulatov
5dcb90858e
Stop waiting for part of LSP responses on remote Collab clients' part (#36557)
Instead of holding a connection for potentially long LSP queries (e.g.
rust-analyzer might take minutes to look up a definition), disconnect
right after sending the initial request and handle the follow-up
responses later.

As a bonus, this allows to cancel previously sent request on the local
Collab clients' side due to this, as instead of holding and serving the
old connection, local clients now can stop previous requests, if needed.

Current PR does not convert all LSP requests to the new paradigm, but
the problematic ones, deprecating `MultiLspQuery` and moving all its
requests to the new paradigm.

Release Notes:

- Improved resource usage when querying LSP over Collab

---------

Co-authored-by: David Kleingeld <git@davidsk.dev>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
Co-authored-by: David Kleingeld <davidsk@zed.dev>
2025-08-21 09:24:34 +03:00
Cole Miller
b6722ca3c8
Remove special case for singleton buffers from MultiBufferSnapshot::anchor_at (#36524)
This may be responsible for a panic that we've been seeing with
increased frequency in agent2 threads.

Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-08-20 18:43:29 +00:00
Umesh Yadav
ec8106d1db
Fix clippy::println_empty_string, clippy::while_let_on_iterator, clippy::while_let_on_iterator lint style violations (#36613)
Related: #36577

Release Notes:

- N/A
2025-08-20 20:14:30 +02:00
Umesh Yadav
1e6cefaa56
Fix clippy::len_zero lint style violations (#36589)
Related: #36577

Release Notes:

- N/A

---------

Signed-off-by: Umesh Yadav <git@umesh.dev>
2025-08-20 14:35:59 +00:00
tidely
bc79076ad3
Fix clippy::manual_map lint violations (#36584)
#36577

Release Notes:

- N/A
2025-08-20 15:17:28 +02:00
tidely
6ed29fbc34
Enforce style lints which do not have violations (#36580)
Release Notes:

- N/A
2025-08-20 14:07:37 +02:00
tidely
7bdc99abc1
Fix clippy::redundant_clone lint violations (#36558)
This removes around 900 unnecessary clones, ranging from cloning a few
ints all the way to large data structures and images.

A lot of these were fixed using `cargo clippy --fix --workspace
--all-targets`, however it often breaks other lints and needs to be run
again. This was then followed up with some manual fixing.

I understand this is a large diff, but all the changes are pretty
trivial. Rust is doing some heavy lifting here for us. Once I get it up
to speed with main, I'd appreciate this getting merged rather sooner
than later.

Release Notes:

- N/A
2025-08-20 12:20:13 +02:00
Piotr Osiewicz
cf7c64d77f
lints: A bunch of extra style lint fixes (#36568)
- **lints: Fix 'doc_lazy_continuation'**
- **lints: Fix 'doc_overindented_list_items'**
- **inherent_to_string and io_other_error**
- **Some more lint fixes**
- **lints: enable bool_assert_comparison, match_like_matches_macro and
wrong_self_convention**


Release Notes:

- N/A
2025-08-20 12:05:58 +02:00
Conrad Irwin
cac80e2ebd
Silence a bucketload of logs (#36534)
Closes #ISSUE

Release Notes:

- Silenced a bunch of logs that were on by default
2025-08-19 20:26:56 -06:00
Max Brunsfeld
ce216432be
Refactor ssh remoting - make ChannelClient type private (#36514)
This PR is one step in a series of refactors to prepare for having
"remote" projects that do not use SSH. The main use cases for this are
WSL and dev containers.

Release Notes:

- N/A
2025-08-19 17:33:56 -07:00
Piotr Osiewicz
6825715503
Another batch of lint fixes (#36521)
- **Enable a bunch of extra lints**
- **First batch of fixes**
- **More fixes**

Release Notes:

- N/A
2025-08-19 20:33:44 +00:00
Piotr Osiewicz
05fc0c432c
Fix a bunch of other low-hanging style lints (#36498)
- **Fix a bunch of low hanging style lints like unnecessary-return**
- **Fix single worktree violation**
- **And the rest**

Release Notes:

- N/A
2025-08-19 21:26:17 +02:00
Lukas Wirth
d1cabef2bf
editor: Fix inline diagnostics min column inaccuracy (#36501)
Closes https://github.com/zed-industries/zed/issues/33346

Release Notes:

- Fixed `diagnostic.inline.min_column` being inaccurate
2025-08-19 16:53:45 +00:00
Lukas Wirth
013eaaeadd
editor: Render dirty and conflict markers in multibuffer headers (#36489)
Release Notes:

- Added rendering of status indicators for multi buffer headers
2025-08-19 18:43:42 +02:00
Piotr Osiewicz
c4083b9b63
Fix unnecessary-mut-passed lint (#36490)
Release Notes:

- N/A
2025-08-19 14:20:01 +00:00
Piotr Osiewicz
8f567383e4
Auto-fix clippy::collapsible_if violations (#36428)
Release Notes:

- N/A
2025-08-19 13:27:24 +00:00
Smit Barmase
47e1d4511c
editor: Fix edit_predictions_disabled_in not disabling predictions (#36469)
Closes #25744

Only setting changes and editor init determined whether to show
predictions, so glob patterns and toggles correctly disabled them. On
cursor changes we call `update_visible_edit_prediction`, but we weren’t
discarding predictions when the scope changed. This PR fixes that.

Release Notes:

- Fixed an issue where the `edit_predictions_disabled_in` setting was
ignored in some cases.
2025-08-19 14:43:41 +05:30
tidely
1fbb318714
Fix iterator related clippy style lint violations (#36437)
Release Notes:

- N/A
2025-08-19 10:06:35 +02:00
Cole Miller
d30b017d1f
Prevent sending slash commands in CC threads (#36453)
Highlight them as errors in the editor, and add a leading space when
sending them so users don't hit the odd behavior when sending these
commands to the SDK.

Release Notes:

- N/A
2025-08-19 02:00:41 -04:00
Gregor
bb640c6a1c
Add multi selection support to UnwrapSyntaxNode (#35991)
Closes #35932
Closes #35933

I only intended to fix multi select in this, I accidentally drive-by
fixed the VIM issue as well. `replace_text_in_range` which I was using
before has two, to me unexpected, side-effects:
- it no-ops when input is disabled, which is the case in VIM's
Insert/Visual modes
- it takes the current selection into account, and does not just operate
on the given range (which I erroneously assumed before)

Now the code is using `buffer.edit` instead, which seems more lower
level, and does not have those side-effects. I was enthused to see that
it accepts a vec of edits, so I didn't have to calculate offsets for
following edits... until I also wanted to set selections, where I do
need to do it by hand. I'm still wondering if there is a simpler way to
do it, but for now it at least passes my muster

Release Notes:

- Added multiple selection support to UnwrapSyntaxNode action
- Fixed UnwrapSyntaxNode not working in VIM Insert/Visual modes
2025-08-19 01:01:46 +03:00
Piotr Osiewicz
9e0e233319
Fix clippy::needless_borrow lint violations (#36444)
Release Notes:

- N/A
2025-08-18 21:54:35 +00:00
Finn Evers
58f7006898
editor: Add tests to ensure no horizontal scrolling is possible in soft wrap mode (#36411)
Prior to https://github.com/zed-industries/zed/pull/34564 as well as
https://github.com/zed-industries/zed/pull/26893, we would have cases
where editors would be scrollable even if `soft_wrap` was set to
`editor_width`. This has regressed and improved quite a few times back
and forth. The issue was only within the editor code, the code for the
wrap map was functioning and tested properly.

Hence, this PR adds two tests to the editor rendering code in an effort
to ensure that we maintain the current correct behavior.

Release Notes:

- N/A
2025-08-18 12:35:54 +00:00
Finn Evers
1add1d042d
Add option to disable auto indentation (#36259)
Closes https://github.com/zed-industries/zed/issues/11780

While auto indentation is generally nice to have, there are cases where
it is currently just not good enough for some languages (e.g. Haskell)
or users just straight up do not want their editor to auto indent for
them. Hence, this PR adds the possibilty to disable auto indentation for
either all language or on a per-language basis. Manual invocation via
the `editor: auto indent` action will continue to work.

Also takes a similar approach as
https://github.com/zed-industries/zed/pull/31569 to ensure performance
is fine for larger multicursor edits.

Release Notes:

- Added the possibility to configure auto indentation for all languages
and per language. Add `"auto_indent": false"` to your settings or
desired language to disable the feature.
2025-08-18 14:21:33 +02:00
Smit Barmase
d5711d44a5
editor: Fix panic in inlay hint while padding (#36405)
Closes #36247

Fix a panic when padding inlay hints if the last character is a
multi-byte character. Regressed in
https://github.com/zed-industries/zed/pull/35786.

Release Notes:

- Fixed a crash that could occur when an inlay hint ended with `...`.
2025-08-18 16:32:01 +05:30
Lukas Wirth
472f1a8cc2
editor: Add right click context menu to buffer headers (#36398)
This adds a context menu to buffer headers mimicking that of pane tabs,
notably being able to copy the relative and absolute paths of the buffer
as well as opening a terminal in the parent.

Confusingly prior to this right clicking a buffer header used to open
the context menu of the underlying editor.

Release Notes:

- Added context menu for buffer titles
2025-08-18 10:40:39 +00:00
Piotr Osiewicz
b8a106632f
lsp: Identify language servers by their configuration (#35270)
- **WIP: reorganize dispositions**
- **Introduce a LocalToolchainStore trait and use it for LspAdapter
methods**

Closes #35782
Closes #27331

Release Notes:

- Python: Improved propagation of a selected virtual environment into
the LSP configuration. This should the make all language-related
features such as Go to definition or Find all references more reliable.

---------

Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Lukas Wirth <lukas@zed.dev>
2025-08-18 11:43:52 +02:00
Lukas Wirth
864d4bc1d1
editor: Drop multiline targets in navigation buffers (#36291)
Release Notes:

- N/A
2025-08-16 07:55:46 +00:00
zumbalogy
f5f14111ef
Add setting for hiding the status_bar.cursor_position_button (#36288)
Release Notes:

- Added an option for the status_bar.cursor_position_button. Setting to
`false` will hide the button. It defaults to `true`.

This builds off the recent work to hide the language selection button
(https://github.com/zed-industries/zed/pull/33977). I tried to follow
that pattern, and to pick a clear name for the option, but any
feedback/change is welcome.

---------

Co-authored-by: zumbalogy <3770982+zumbalogy@users.noreply.github.com>
2025-08-16 09:19:38 +03:00
Finn Evers
3e0a755486
Remove some redundant entity clones (#36274)
`cx.entity()` already returns an owned entity, so there is no need for
these clones.

Release Notes:

- N/A
2025-08-15 20:27:44 +00:00
Cole Miller
1931889759
thread_view: Move handlers for confirmed completions to the MessageEditor (#36214)
Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-08-15 18:55:34 +00:00
Finn Evers
3c5d5a1d57
editor: Add access method for project (#36266)
This resolves a `TODO` that I've stumbled upon too many times whilst
looking at the editor code.

Release Notes:

- N/A
2025-08-15 18:34:22 +00:00
Igal Tabachnik
7993ee9c07
Suggest unsaved buffer content text as the default filename (#35707)
Closes #24672

This PR complements a feature added earlier by @JosephTLyons (in
https://github.com/zed-industries/zed/pull/32353) where the text is
considered as the tab title in a new buffer. It piggybacks off that
change and sets the title as the suggested filename in the save dialog
(completely mirroring the same functionality in VSCode):

![2025-08-05 11 50
28](https://github.com/user-attachments/assets/49ad9e4a-5559-44b0-a4b0-ae19890e478e)

Release Notes:

- Text entered in a new untitled buffer is considered as the default
filename when saving
2025-08-15 17:26:38 +02:00
Lukas Wirth
e2ce787c05
editor: Limit target names in hover links multibuffer titles (#36207)
Release Notes:

- N/A
2025-08-14 21:18:07 +00:00
Mostafa Khaled
5a9546ff4b
Add alt-s to helix mode (#33918)
Closes #31562

Release Notes:

- Helix: bind alt-s to SplitSelectionIntoLines

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
2025-08-14 13:04:38 -04:00
Joseph T. Lyons
f514c7cc18
Emit a BreadcrumbsChanged event when associated settings changed (#36177)
Closes https://github.com/zed-industries/zed/issues/36149

Release Notes:

- Fixed a bug where changing the `toolbar.breadcrumbs` setting didn't
immediately update the UI when saving the `settings.json` file.
2025-08-14 11:22:38 -04:00