## Context
To support inline values a language will have to implement their own
provider trait that walks through tree sitter nodes. This is overly
complicated, hard to accurately implement for each language, and lacks
proper extension support.
This PR switches to a singular inline provider that uses a language's
`debugger.scm` query field to capture variables and scopes. The inline
provider is able to use this information to generate inlays that take
scope into account and work with any language that defines a debugger
query file.
### Todos
- [x] Implement a utility test function to easily test inline values
- [x] Generate inline values based on captures
- [x] Reimplement Python, Rust, and Go support
- [x] Take scope into account when iterating through variable captures
- [x] Add tests for Go inline values
- [x] Remove old inline provider code and trait implementations
Release Notes:
- debugger: Generate inline values based on a language debugger.scm file
Instead of a menagerie of macros for implementing `Action`, now there
are just two:
* `actions!(editor, [MoveLeft, MoveRight])`
* `#[derive(..., Action)]` with `#[action(namespace = editor)]`
In both contexts, `///` doc comments can be provided and will be used in
`JsonSchema`.
In both contexts, parameters can provided in `#[action(...)]`:
- `namespace = some_namespace` sets the namespace. In Zed this is
required.
- `name = "ActionName"` overrides the action's name. This must not
contain "::".
- `no_json` causes the `build` method to always error and
`action_json_schema` to return `None`
and allows actions not implement `serde::Serialize` and
`schemars::JsonSchema`.
- `no_register` skips registering the action. This is useful for
implementing the `Action` trait
while not supporting invocation by name or JSON deserialization.
- `deprecated_aliases = ["editor::SomeAction"]` specifies deprecated old
names for the action.
These action names should *not* correspond to any actions that are
registered. These old names
can then still be used to refer to invoke this action. In Zed, the
keymap JSON schema will
accept these old names and provide warnings.
- `deprecated = "Message about why this action is deprecation"`
specifies a deprecation message.
In Zed, the keymap JSON schema will cause this to be displayed as a
warning. This is a new feature.
Also makes the following changes since this seems like a good time to
make breaking changes:
* In `zed.rs` tests adds a test with an explicit list of namespaces. The
rationale for this is that there is otherwise no checking of `namespace
= ...` attributes.
* `Action::debug_name` renamed to `name_for_type`, since its only
difference with `name` was that it
* `Action::name` now returns `&'static str` instead of `&str` to match
the return of `name_for_type`. This makes the action trait more limited,
but the code was already assuming that `name_for_type` is the same as
`name`, and it requires `&'static`. So really this just makes the trait
harder to misuse.
* Various action reflection methods now use `&'static str` instead of
`SharedString`.
Release Notes:
- N/A
<img width="1728" alt="image"
src="https://github.com/user-attachments/assets/a63925a7-8e13-4d48-bd31-33f434209ea6"
/>
Diagnostics UI elements (underlines, popovers, hovers) are quite noisy
by themselves and get even more so with the git background colors.
Release Notes:
- Stopped showing diagnostics in the diff-related editors
This PR addresses to fix (#31308) a race condition where auto-indent (in
buffer.cs) and on-type-formatting (in lsp_store.rs) concurrently
calculate indentation using the same buffer snapshot.
Previous Solution (Abandoned):
https://github.com/zed-industries/zed/pull/31340
Final Solution:
Delay applying on-type-formatting until auto-indent is complete.
Issue:
If AutoindentMode finishes first, formatting works correctly. If
"Formatting on typing" starts before AutoindentMode completes, it
results in double indentation.
Closes#31308
Release Notes:
- Fixed a race condition resulting in incorrect buffer contents when combining auto-indent and on-type-formatting
Previously, if editing a long previous user message in the thread, you'd
have a double scroll situation because the editor used in that case had
its max number of lines capped. To solve that, I made the `max_lines` in
the editor `AutoHeight` mode optional, allowing me to not pass any
arbitrary number to the previous user message editor, and ultimately,
solving the double scroll problem by not having any scroll at all.
Release Notes:
- agent: Fixed double scroll that happened when editing a long previous
user message.
@ConradIrwin adding you as a reviewer as I'm touching editor code
here... want to be careful. :)
Closes#33106
Instead of directly using `filter_text` in `StringMatchCandidate`, which
yields better results for fuzzy matching but messes up with highlighting
letters in bold, as `positions` list generated by fuzzy crate are now of
`filter_text` and not `label` shown to the user.
This PR fixes it by keeping use of `filter_range` in
`StringMatchCandidate`, which is range w.r.t to `label` shown to user.
And actually generating this `filter_range` at source by using
`filter_range` if exists.
- [x] Tests
Release Notes:
- Fixed issue where incorrect letters are marked as bold in completions.
Closes#30191
`line_ix` should never exceed the bounds of `line_layouts`, but a panic
happens on out-of-bounds for this, which seems weird. I couldn’t
reproduce this panic at all. Since this is for displaying inline blame,
we now log an error if this occurs instead of panicking.
Release Notes:
- N/A
Bug in #31872Closes#32774
Release Notes:
- Fixed a bug in LSP completions caching where prior completions may be
used when they should not, after typing a trigger char like `.`
https://github.com/user-attachments/assets/ad0fa304-e4fb-4598-877d-c02141f35d6f
Closes https://github.com/zed-industries/zed/issues/4678
Also adds the code to support `textDocument/colorPresentation`
counterpart that serves as a resolve mechanism for the document colors.
The resolve itself is not run though, and the editor does not
accommodate color presentations in the editor yet — until a well
described use case is provided.
Use `lsp_document_colors` editor settings to alter the presentation and
turn the feature off.
Release Notes:
- Start showing inline previews for LSP document colors
Release Notes:
- Add a setting to show the minimap only on the current active editor
(file)
- This can be configured on `settings.json`:
```json
{
"minimap": {
"display_in": "active_editor", // defaults to "all_editors"
}
}
```
- The minimap won't hide if you go from an editor pane to the terminal,
the project panel, the search bar, etc. It will only hide if you go from
one editor pane to another.
Preview:

Only the active editor (left) displays the minimap.
On the panics dashboard, saw this panic of `There must be at least one
selection` in `open_locations_in_multibuffer`. Only seems to have
happened once in the past month.
Fix is to include the pending selection. Since `selections.all()` cannot
provide anchor selections, added `selections.all_anchors()` which only
really does any work if there is a pending selection.
Also fixes a corner case in jump-to-definitions where if the definition
is `HoverLink::InlayHint` and the `compute_target_location` fails for
all definitions it could potentially also trigger this case (and return
`Navigated::Yes` instead of `Navigated::No`
Release Notes:
- N/A
Crashes look like:
```
Panic `offset 632 is greater than the snapshot.len() 631` on thread 0 (com.apple.main-thread)
<multi_buffer::MultiBufferSnapshot>::innermost_enclosing_bracket_ranges::<usize>
editor::highlight_matching_bracket::refresh_matching_bracket_highlights
<gpui::app::App>::update_window_id::<bool, <gpui::app::context::Context<editor::Editor>>::subscribe_in<multi_buffer::MultiBuffer, multi_buffer::Event, <editor::Editor>::on_buffer_event>::{closure#0}::{closure#0}>::{closure#0}
<gpui::app::context::Context<editor::Editor>>::subscribe_in::<multi_buffer::MultiBuffer, multi_buffer::Event, <editor::Editor>::on_buffer_event>::{closure#0}
<gpui::app::App>::flush_effects
<project::lsp_store::LocalLspStore>::format_buffer_locally::{closure#0}
<project::lsp_store::LspStore>::format::{closure#1}::{closure#0}::<i32>
```
Though `format_buffer_locally` is not always present. Both issue reports
mention usage of the agent. I suspect this is somehow a result of agent
format-on-save combined with the user's cursor being at the end of the
buffer as it's getting edited by the agent.
The offsets are always off-by-one in the error, so at first I thought
the issue was the condition `head < snapshot.buffer_snapshot.len()`
before setting `tail` to be `head + 1`, but an offset equal to len is
valid. Seems like to get a `to_offset` crash, `head` must be greater
than `len`. Which is quite weird, a selection's offset should never be
out of bounds.
Since this code is just about highlighting brackets, this PR logs an
error instead of crashing in the `head > len` case.
Closes#32732, #32171
Release Notes:
- N/A
- [x] foreground highlights
- [x] background highlights
- [x] advertise support in DAP capabilities
Closes#31372
Release Notes:
- Debugger Beta: added basic support for highlighting in the console
based on ANSI escape codes.
Closes#32787
Follow-up to #27519 and #32408
This PR fixes an issue where the mouse cursor would stay hidden after
typing in the editor.
Before #32408, we would rerender the editor on every mouse move. Now, we
(correctly) only do this if a rerender is actually required. This caused
a small regression for hiding the mouse cursor though: Due to the view
now being cached, we do not neccessarily update the mouse cursor style
so it is shown again. The boolean is updated but the view is not,
resulting in the cursor style being kept until another action is
performed. This is an issue with both Stable and Preview (due to some
other changes, the issue is slightly worse on Preview though, see
https://github.com/zed-industries/zed/pull/32596#issuecomment-2969258800
and
https://github.com/zed-industries/zed/pull/32596#issuecomment-2969357248
for some more context).
This PR ensures that the cursor is shown again by scheduling a redraw of
the editor whenever the boolean is updated.
The change should not cause any performance regressions: In most cases
where we want to hide the mouse, the editor is about to be rerendered
anyway, hence this would not change anything. For cases where we want to
show the cursor again, this ensures that we actually end up doing so by
rerendering the editor once.
Release Notes:
- Fixed an issue where the mouse cursor would sometimes stay hidden
after typing in editors with the `hide_mouse` setting enabled.
Closes#32584
In https://github.com/zed-industries/zed/pull/31888, we changed the
default `opt + shift` behavior to start columnar selection from the
mouse position (Sublime-like behavior) instead of from the existing
selection head (VSCode-like behavior).
It turns out there is a use case for creating columnar selection from an
existing selection head as well, such as creating a consecutive
multi-cursor from existing selection head with just a click instead of
dragging.
This PR brings back columnar selection from the selection head via `opt
+ shift`, while retaining columnar selection from the mouse position,
which is now mapped to the new `cmd + shift` binding.
Note: If you like to swap the binding, you can use [existing multi
cursor modifier
setting](https://zed.dev/docs/configuring-zed?highlight=multi_cursor_modifier#multi-cursor-modifier).
Release Notes:
- Added `cmd + shift` to start columnar selection from the mouse
position.
- Restored `opt + shift` to create columnar selection (or consecutive
multi-cursor on click) from the selection head.
The condition for displaying the first char of the placeholder text in
the block cursor was `cursor_column == 0`. This meant that it was
displayed on the first column even when the placeholder text is not
being displayed. Instead this now shows it only when
`snapshot.is_empty()` - the same condition used to determine whether to
show placeholder text.
In the case of vim mode + agent panel message editor, this meant that if
you did `shift-enter` to make a newline and then `escape` to enter
normal mode, the block cursor would show `M` inside it as that's the
first character of the placeholder text "Message the agent - @ to
include context"
Release Notes:
- N/A
* Adds `min_lines` to `EditorMode::AutoHeight` and use `min_lines: 4` in
agent message editor. This makes it so that clicks in the blank space
below the first line of the editor also focus it, instead of needing to
click the very first line.
* Removes the div wrapping the editor, as it was only there to set
`min_h_16()`. This also tightens up the min space given to the editor -
before it was not evenly dividing the number of lines.
* Further tightens up vertical spacing by using `gap_1` instead of
`gap_4` between editor and controls below
At 4 line min height (after on the left, before on the right):

At 5 lines, one more than min height (after on the left, before on the
right):

Release Notes:
- Agent: Fixed clicking to focus the message editor to also work for
clicks below the last line.
Similar to https://github.com/zed-industries/zed/pull/32683, checking
mouse hovered in `mouse_move` instead of `prepaint` for diff hunk
controls.
Release Notes:
- Fixed issue where diff hunk controls were not visible on mouse hover
when `cursor_blink` is `false`.
We recently fixed the issue of `cx.notify` on every mouse move event
https://github.com/zed-industries/zed/pull/32408. As this perf bug was
there for a long time, we made some not-optimal choices for checking
things like if the mouse is hovering over an element in the prepaint
phase rather than the `mouse_move` listener.
After the mentioned fix, it regressed these code paths as prepaint is
not being called for every other frame, and hence the mouse hovering
logic never triggers. This bug is directly noticeable when the
"cursor_blink" setting is turned off, which notifies the editor on every
second.
This PR fixes that for git inline blame popover by moving logic to
show/hide in `mouse_move` instead of prepaint phase. `cx.notify` is only
get called only when popover is shown or hidden.
Release Notes:
- Fixed git inline blame not correctly showing in Editor on hover when
`cursor_blink` is `false`.
Release Notes:
- Added initial support for both `z l` and `z h` in vim mode
These changes relate to #17219 but don't yet close the issue, as this
Pull Request is simply adding support for horizontal scrolling in vim
mode and actually moving the cursor to the correct column in the current
row will be handled in a different Pull Request.
Some notes on these changes:
- 2 new default keybindings added to vim's keymap
- `z l` which triggers the new `vim::ColumnRight` action
- `z h` which triggers the new `vim::ColumnLeft` action
- Introduced a new `ScrollAmount` variant, `ScrollAmount::Column(f32)`
to represent horizontal scrolling
- Replaced usage of `em_width` with `em_advance` to actually scroll by
the width of the cursor, instead of the width of the character
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Reland of #30345 to fix merge conflicts with the new skip-completions
option
Fixes#29431Fixes#17592
Release Notes:
- vim: Scrolls are no longer added to the jumplist
Closes https://github.com/zed-industries/zed/issues/12091
Use `"save_non_dirty_buffers": false` editor settings to disable this
behavior.
Release Notes:
- Fixed formatting effects not triggered when saving unmodified
singleton buffers
This fixes a bug introduced in #32579 where the code runner menu would
be deployed from the most recent cursor position instead of the row that
the runner icon was rendered on.
Release Notes:
- N/A
I don't think the documentation comment is saying the right thing. This
version is more similar to the comment of the left movement function.
Release Notes:
- N/A
Closes#21860
Release Notes:
- Added `ch_width` and `ch_advance` function alongside their `em_*`
counterparts
- Use `ch_*` version to calculate gutter layouts
- Update a stale comment from changes in #31959
The ch units refer to the width of the number `0` whereas em is the
width of `m` and the actual font size (e.g. 16px means 16 px width of
`m`).
This change has no effect for monospaced fonts but can be drastic for
proportional ones as seen below for "Zed Plex Sans" with a
`"min_line_number_width" = 4`.
<img width="726" alt="Screenshot 2025-06-11 at 15 47 35"
src="https://github.com/user-attachments/assets/aa73f4d4-32bc-42cf-a9f6-7e25fee68c9a"
/>
- Add `300ms` delay for it to consider it as selection drag instead of
an attempt to make a new selection.
- Add cursor icon while dragging the selection.
This is same as what chromium does:
https://chromium.googlesource.com/chromium/blink/+/master/Source/core/input/EventHandler.cpp#142
Release Notes:
- Fixed issue where you accidentally end up dragging the selection where
intent was to make a new one instead. To drag selection now, you need to
hold just a little longer before dragging.
Now if you click the triangle you get runnables, if you click the
lightning bolt you get code actions, if you trigger the code actions
menu with the mouse/keyboard you still get both.
Release Notes:
- Fixed the run/code actions menu to not duplicate content when opened
from the respective icons.
---------
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
This PR makes it a lot cleaner to write code completion tests. It
doesn't contain any logical changes, just refactoring.
Before, we used to depend on hard-coded values of fuzzy score and its
positions for tests. Now we don't need them, as fuzzy crate will handle
that for us. This is possible because fuzzy match score isn't dependent
on relative candidates or the number of candidates; rather, it's just a
one-to-one mapping for each candidate and its score.
This also makes it test robust for future purposes if there are changes
in fuzzy score logic.
Before:
```rs
SortableMatch {
string_match: StringMatch { // -> whole struct provided by fuzzy crate
candidate_id: 1115,
score: 1.0,
positions: vec![],
string: "Item".to_string(),
},
is_snippet: false, // -> changed to snippet kind
sort_text: Some("16"),
sort_kind: 3, // -> changed to function, constant, variable kind
sort_label: "Item",
},
```
After:
```rs
CompletionBuilder::function("Item", "16")
```
Release Notes:
- N/A
Closes#7334
# Changes
This PR makes the minimum width allocated for line numbers in the side
gutter configurable in units of character width via the
`"line_number_base_width"` attribute in `gutter` settings. Set the
previously hard coded value of `4` as default.
Together with other settings (`"folds"`, `"breakpoints"`,...) this gives
the user control over the gutter width.
If the number of lines exceedes the base width, the number of digits in
the largest line number is chosen instead. This is consistent with
previous behaviour.
Screenshot for reference:
<img width="1104" alt="Screenshot 2025-06-03 at 12 15 29"
src="https://github.com/user-attachments/assets/77c869ad-164b-4b74-8e39-8be43d740ad4"
/>
P.S.: This is my first time contributing to zed (yay!🎉). Let me know if
i'm missing something.
Release Notes:
- Make minimum line number width in gutter configurable
Closes#32456https://github.com/zed-industries/zed/pull/32007 added showing
pre-emptive keys for multi-key bindings. But for certain keys like
"control", "backspace", "escape", "shift", "f1", etc., shouldn't be
shown as these keys would not end up in buffer after pending input
delay. This PR changes it to use just `key_char`, as it represents
actual text that will end up in buffer and is `None` for all mentioned
keys.
fad4c17c97/crates/gpui/src/platform/keystroke.rs (L14-L21)
cc @ConradIrwin
Release Notes:
- Fixed issue where triggering multi-key binding like "shift",
"control", etc. would write them to the buffer for a short time.
Closes#32159
This PR refines the scope to match just the function name with **the
type argument** instead of the whole call expression.
Matching to whole call expression prevented methods from expanding
inside the function argument. For example, `const foo =
bar(someMethod(2)^);` instead of `const foo = bar(someMethod^)`;
Follow-up for https://github.com/zed-industries/zed/pull/30312,
https://github.com/zed-industries/zed/pull/30351. Mistakenly regressed
since https://github.com/zed-industries/zed/pull/31872 when we stopped
receiving `insert_range` for this particular case and fallback to
`replace_range`.
Release Notes:
- Fixed issue where code completion in TypeScript function arguments
sometimes omitted the dot separator, for example resulting in
`NumberparseInt` instead of `Number.parseInt(string)`.
---------
Co-authored-by: Michael Sloan <michael@zed.dev>
Co-authored-by: Michael Sloan <mgsloan@gmail.com>
As part of this I refactored the logic that enabled/disabled actions in
the debugger to happen at action registration time instead of using
command palette filters. This allows the menu to grey out actions correctly.
Release Notes:
- Add a "Run" menu to contain tasks and debugger