Commit graph

3965 commits

Author SHA1 Message Date
Michael Sloan
2f3acb6185
Fix panic when editor::OpenSelectionsInMultibuffer only has pending selection (#32842)
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
2025-06-17 08:35:14 +00:00
Michael Sloan
d92d52b508
Attempt to log error instead of crash in bracket highlighting (#32837)
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
2025-06-17 07:26:58 +00:00
Cole Miller
ffc6218349
debugger: Process ANSI color escape codes in console (#32817)
- [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.
2025-06-16 17:39:53 -04:00
Smit Barmase
c7de817bf9
editor: Fix code action not visible until mouse move or buffer interaction (#32804)
Closes #32796

Regressed since https://github.com/zed-industries/zed/pull/32408. Fixed
in same way as other related PRs
https://github.com/zed-industries/zed/pull/32683,
https://github.com/zed-industries/zed/pull/32692,
https://github.com/zed-industries/zed/pull/32795.

Release Notes:

- Fixed issue where code actions are not visible until the mouse is
moved when the `cursor_blink` setting is `false`.
2025-06-16 22:25:25 +05:30
Finn Evers
b749d9302f
editor: Ensure mouse cursor is shown again on mouse move (#32795)
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.
2025-06-16 19:49:08 +05:30
Smit Barmase
ef61ebe049
editor: Support both cursor and mouse based columnar selection (#32779)
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.
2025-06-16 10:13:25 +05:30
Michael Sloan
3810227759
Misc nitpicks, changes too small / unrelated to be in other PRs (#32768)
Release Notes:

- N/A
2025-06-15 19:51:04 +00:00
Michael Sloan
c0717bc613
Fix block cursor using placeholder text even when it's not displayed (#32766)
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
2025-06-15 19:09:18 +00:00
Michael Sloan
681c88d4e7
Fix clicking in to agent message editor and tighten up vertical spacing (#32765)
* 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):


![image](https://github.com/user-attachments/assets/e8eefb1b-9ea3-4f98-ad55-25f95760d61f)

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


![image](https://github.com/user-attachments/assets/a6ba737c-6a56-4343-a55a-d264f2a06377)

Release Notes:

- Agent: Fixed clicking to focus the message editor to also work for
clicks below the last line.
2025-06-15 18:45:44 +00:00
Smit Barmase
2aa79a022e
editor: Fix diff hunk controls not shown until buffer interaction (#32692)
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`.
2025-06-13 22:29:49 +05:30
Smit Barmase
aa1cb9c1e1
editor: Fix inline blame show/hide not working until buffer interaction (#32683)
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`.
2025-06-13 17:53:13 +05:30
Piotr Osiewicz
d5b8c21a75
debugger: Mark DapLocator::create_scenario as an async function (#32680)
Paves way for locators in extensions.

Release Notes:

- N/A
2025-06-13 13:19:03 +02:00
Dino
9a6e8a19b5
vim: Add horizontal scrolling support in vim mode (#32558)
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>
2025-06-13 00:17:15 -06:00
Conrad Irwin
9166e66519
Disable nav history in vim scrolls (#32656)
Reland of #30345 to fix merge conflicts with the new skip-completions
option

Fixes #29431
Fixes #17592

Release Notes:

- vim: Scrolls are no longer added to the jumplist
2025-06-12 22:18:22 -06:00
Kirill Bulatov
cef0c415f6
Don't autosave unmodified buffers (#32626)
Closes https://github.com/zed-industries/zed/issues/12091

Proper redo of https://github.com/zed-industries/zed/pull/32603

Release Notes:

- Fixed formatting effects not triggered when saving unmodified
singleton buffers

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Cole Miller <m@cole-miller.net>
2025-06-12 22:12:14 +00:00
Kirill Bulatov
e56a027bea
Store result_ids per language server (#32631)
Follow-up of https://github.com/zed-industries/zed/pull/32403


Release Notes:

- N/A
2025-06-12 19:36:08 +00:00
Smit Barmase
f54129461f
editor: Improve completions sort order for Tailwind classes (#32612)
Closes #32532

Before:
<img width="479" alt="Image"
src="https://github.com/user-attachments/assets/5eeee2b8-7f0f-43c1-bbde-65db8ae0dce1"
/>

After:
<img width="580" alt="image"
src="https://github.com/user-attachments/assets/6c6f30ea-e92e-41f7-ba5e-b1616652d367"
/>


Release Notes:

- Improved auto-complete suggestions for Tailwind classes.
2025-06-12 20:23:16 +05:30
Kirill Bulatov
5e07d0f6de
Trigger formatting effects when saving unmodified singleton buffers (#32603)
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
2025-06-12 12:25:32 +00:00
Anthony Eid
c7ee635853
Deploy code runner menu from correct display row (#32594)
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
2025-06-12 07:22:58 +00:00
fantacell
1a321b51df
Rewrite documentation comment for right movement (#32547)
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
2025-06-12 08:39:17 +03:00
Max Mynter
242af863f5
Use ch-width (0) instead of em-width (m) for gutter width calculation (#32548)
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"
/>
2025-06-12 08:28:04 +03:00
Smit Barmase
13ee78c0b4
editor: Add delay for selection drag to prevent accidental drag over attempt for new selection (#32586)
- 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.
2025-06-12 06:07:20 +05:30
Conrad Irwin
2a63c5f951
Fix code actions run confusion (#32579)
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>
2025-06-11 16:51:46 -06:00
Smit Barmase
65a1d09d24
editor: Use fuzzy crate in code completions tests instead of hard coded values (#32565)
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
2025-06-11 23:26:19 +05:30
Max Mynter
7d5a5d0984
Make minimum width for line numbers in gutter configurable (#31959)
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
2025-06-11 10:00:50 +00:00
Smit Barmase
6d9bcdb2af
editor: Fix certain unwanted pre-emptive keys been shown in buffer (#32528)
Closes #32456

https://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.
2025-06-11 14:16:21 +05:30
Smit Barmase
fc4ca346be
editor: Adjust scope for prefer label for snippet workaround (#32515)
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>
2025-06-11 10:38:39 +05:30
Conrad Irwin
00a8101016
Add a run menu (#32505)
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
2025-06-10 19:57:46 -06:00
Kirill Bulatov
9c513223c4
Add initial package.json scripts task autodetection (#32497)
Now, every JS/TS-related file will get their package.json script
contents added as tasks:

<img width="1020" alt="image"
src="https://github.com/user-attachments/assets/5bf80f80-fd72-4ba8-8ccf-418872895a25"
/>

To achieve that, `fn associated_tasks` from the `ContextProvider` was
made asynchronous and the related code adjusted.

Release Notes:

- Added initial `package.json` scripts task autodetection

---------

Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
2025-06-10 22:16:27 +00:00
Michael Sloan
4f5433a180
Filter language server completions even when is_incomplete: true (#32491)
In #31872 I changed the behavior of completions to not filter instead of
requerying completions when `is_incomplete: false`. Unfortunately this
also stopped filtering completions when `is_incomplete: true` - we still
want to filter the incomplete completions so that the menu updates
quickly even when completions are slow. This does mean that the
completions menu will display partial results, hopefully only briefly
while waiting for fresh completions.

Thanks to @mikayla-maki for noticing the regression. Thankfully just in
time to fix it before this makes it into a stable release. Leaving off
release notes since I will cherry-pick this to the current preview
version, 190.x, and there probably won't be a preview release before the
next stable.

Release Notes:

- N/A
2025-06-10 21:01:59 +00:00
Joseph T. Lyons
5270844b42
Revert "Preserve selection direction when running editor: open selections in multibuffer" (#32483)
Reverts zed-industries/zed#31399

I found that in some cases, Zed will panic when using `editor: open
selections in multibuffer` if the selection is reversed. It doesn't
happen in most cases that I've tested, but in some strange edge cases
(that I dont fully understand ATM), it does. I'm reverting for now, as
the previous behavior is better than a panic, but will re-implement this
fix to preserving selection directions in a new PR with comprehensive
testing

Release Notes:

- N/A
2025-06-10 15:31:38 -04:00
Ben Kunkle
f567bb52ff
gpui: Simplify uniform list API by removing entity param (#32480)
This PR also introduces `Context::processor`, a sibling of
`Context::listener` that takes a strong pointer to entity and allows for
a return result.

Release Notes:

- N/A

Co-authored-by: Mikayla <mikayla@zed.dev>
2025-06-10 18:50:57 +00:00
Kirill Bulatov
c1a4a24bce
Ensure pull diagnostics do not happen for non-full mode editors (#32449)
Follow-up of https://github.com/zed-industries/zed/pull/19230

Release Notes:

- N/A
2025-06-10 12:05:45 +00:00
CharlesChen0823
eb5f59577d
editor: Dismiss drag selection when dropped outside editor (#32382)
This PR fixes two issues:

1. On macOS, using Alt to copy the selection instead of cutting it.
2. Dropping the drag selection outside the editor dismisses it.  


https://github.com/user-attachments/assets/341e21c3-3eca-4e58-9bcc-8ec1de18e999


Release Notes:

- N/A

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2025-06-10 15:41:59 +05:30
Michael Sloan
64d649245c
Add missing #[track_caller] meant to be in #32433 (#32434)
Release Notes:

- N/A
2025-06-10 04:52:43 +00:00
Michael Sloan
08210b512d
Don't push to selection history if selections are empty (#32433)
I got a panic during undo but haven't been able to repro it. Potentially
a consequence of my changes in #31731

> Thread "main" panicked with "There must be at least one selection" at
crates/editor/src/selections_collection.rs

Leaving release notes blank as I'm not sure this actually fixes the
panic

Release Notes:

- N/A
2025-06-10 04:29:45 +00:00
Michael Sloan
6070aea6c0
Skip adding initial 1:1 cursor position to selection history (#32432)
Also improves some minor corner cases in `undo_selection` and
`redo_selection` related to the use of `end_selection`. If the pending
selection was ended, this would separately get pushed to the redo or
undo stack and redundantly run all the other effects of selection
change.

Release Notes:

- N/A
2025-06-10 04:22:46 +00:00
JonasKaplan
f0ce62ead8
editor: Add trailing whitespace rendering (#32329)
Closes #5237

- Adds "trailing" option for "show_whitespaces" in settings.json
- Supports importing this setting from vscode

The option in question will render only whitespace characters that
appear after every non-whitespace character in a given line.

Release Notes:

- Added trailing whitespace rendering
2025-06-09 20:48:49 +00:00
Michael Sloan
bbd2262a93
Fix buffer rendering on every mouse move (#32408)
Closes #32210

This notify was added in #13433. Solution is to only notify when the
breakpoint indicator state has changed.

Also improves the logic for enqueuing a task to delay showing - now only
does this if it isn't already visible, and that delay task now only
notifies if still hovering.

Release Notes:

- Fixed a bug where buffers render on every mouse move.
2025-06-09 14:10:03 -06:00
Nate Butler
0b7583bae5
Refine styling of merge conflicts (#31012)
- Improved colors
- Blank out diff hunk gutter highlights in conflict regions
- Paint conflict marker highlights all the way to the gutter

Release Notes:

- Improved the highlighting of merge conflict markers in editors.

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Co-authored-by: Cole Miller <cole@zed.dev>
2025-06-09 19:03:19 +00:00
Kirill Bulatov
fa54fa80d0
Store pulled diagnostics' result_ids more persistently (#32403)
Follow-up of https://github.com/zed-industries/zed/pull/19230

`BufferId` can change between file reopens: e.g. open the buffer, close
it, go back in history to reopen it — the 2nd one will have a different
`BufferId`, but the same `result_ids` semantically.

Release Notes:

- N/A
2025-06-09 17:05:33 +00:00
Tommy D. Rossi
2c5d2a58d8
Do not skip punctuation characters with alt-arrow if next character is \n (#32368)
Closes #32356

Release Notes:

- N/A
2025-06-09 09:25:32 -06:00
Piotr Osiewicz
72bcb0beb7
chore: Fix warnings for Rust 1.89 (#32378)
Closes #ISSUE

Release Notes:

- N/A
2025-06-09 13:11:57 +02:00
Smit Barmase
c57a6263aa
editor: Fix select when click on existing selection (#32365)
Follow-up for https://github.com/zed-industries/zed/pull/30671

Now, when clicking on an existing selection, the cursor will change on
`mouse_up` when `drag_and_drop_selection` is `true`. When
`drag_and_drop_selection` is `false`, it will change on `mouse_down`
(previous default).

Release Notes:

- N/A
2025-06-09 11:58:06 +05:30
Joseph T. Lyons
ebea734515
Coalesce consecutive spaces in new buffer tab titles (#32363)
VS Code has a behavior where it coalesces consecutive spaces in new
buffer tab titles, which I quite like. This presents the content better
and allows more meaningful content to be displayed, as consecutive
spaces don't count towards the 40 character limit.

VS Code

<img width="1013" alt="SCR-20250608-uelt"
src="https://github.com/user-attachments/assets/71a1fd4b-a506-4eab-b6a4-66096a12f1ad"
/>

Zed

<img width="1136" alt="SCR-20250608-ueif"
src="https://github.com/user-attachments/assets/f40fc3c9-0f0f-471d-93ed-be9568fbe778"
/>


Release Notes:

- N/A
2025-06-09 02:01:32 -04:00
CharlesChen0823
4fe05530b0
editor: Add support for drag_and_drop_selection (#30671)
Closes #4958 

Release Notes:

- Added support for drag and drop text selection. It can be disabled by
setting `drag_and_drop_selection` to `false`.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2025-06-09 10:21:18 +05:30
Joseph T. Lyons
b15aef4310
Introduce dynamic tab titles for unsaved files based on buffer content (#32353)
https://github.com/user-attachments/assets/0bb08784-251c-4221-890a-2d6b3fb94e0f

For new, unsaved files:

- If a buffer has no content, or contains only whitespace, use
`untitled`
- If a buffer has content, take the first 40 chars of the first line

| Sublime | VS Code | Zed |
|---------|---------|-----|
| <img width="227" alt="SCR-20250608-ouux"
src="https://github.com/user-attachments/assets/d02b1e50-5775-4252-86e6-6c9d3f6c72fb"
/> | <img width="230" alt="SCR-20250608-ousn"
src="https://github.com/user-attachments/assets/7c9c016b-642f-4a80-9bc1-8c9bdc7bbd32"
/> | <img width="242" alt="SCR-20250608-ovbg"
src="https://github.com/user-attachments/assets/c7f4be5c-5bba-4a2a-b477-1392ca938cd5"
/> |

Note that this implementation also trims all leading whitespace, so that
if the buffer has any non-whitespace content, we use it. VS Code and
Sublime do not do this.

| Sublime | VS Code | Zed |
|---------|---------|-----|
| <img width="233" alt="SCR-20250608-oviq"
src="https://github.com/user-attachments/assets/ccffecc6-0f46-4d1b-8739-740240bc067b"
/> | <img width="198" alt="SCR-20250608-ovkq"
src="https://github.com/user-attachments/assets/35c20149-f898-417b-aff3-dda22b8cc1f3"
/> | <img width="233" alt="SCR-20250608-ovns"
src="https://github.com/user-attachments/assets/2509e8f6-254b-4fcb-a0ea-e18e95bb685b"
/> |

Release Notes:

- Introduced dynamic tab titles for unsaved files based on buffer
content
2025-06-08 17:30:33 -04:00
Richard Feldman
0da97b0c8b
editor: Respect multi_cursor_modifier setting when making columnar selections using mouse (#32273)
Closes https://github.com/zed-industries/zed/issues/31181

Release Notes:

- Added the `multi_cursor_modifier` setting to be respected when making
columnar selections using the mouse drag.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2025-06-08 01:51:13 +05:30
Kirill Bulatov
fa02bd71c3
Select applicable positions for lsp_ext methods more leniently (#32272)
Closes https://github.com/zed-industries/zed/issues/27238

Release Notes:

- Fixed `editor::SwitchSourceHeader` and
`editor::ExpandMacroRecursively` not working with text selections
2025-06-06 22:47:20 +00:00
Kirill Bulatov
77ead25f8c
Implement the rest of the worktree pulls (#32269)
Follow-up of https://github.com/zed-industries/zed/pull/19230

Implements the workspace diagnostics pulling, and replaces "pull
diagnostics every open editors' buffer" strategy with "pull changed
buffer's diagnostics" + "schedule workspace diagnostics pull" for the
rest of the diagnostics.

This means that if the server does not support the workspace diagnostics
and does not return more in linked files, only the currently edited
buffer has its diagnostics updated.

This is better than the existing implementation that causes a lot of
diagnostics pulls to be done instead, and we can add more heuristics on
top later for querying more diagnostics.

Release Notes:

- N/A
2025-06-06 21:19:46 +00:00