Commit graph

536 commits

Author SHA1 Message Date
Lukas Wirth
b8c3167a9d
diagnostics: Always expand at least multibuffer_context_lines per diagnostic (#56172)
Otherwise we can sometimes end up with single line excerpts which looks
very off



Release Notes:

- Improved the minimum size of diagnostics pane excerpts
2026-05-08 14:18:44 +00:00
Kirill Bulatov
c049193fd9
Make all status bar tools able to hide its button via UI (#54971)
Closes https://github.com/zed-industries/zed/discussions/53471

Adds a requirement on status bar items to provide a way to hide
themselves.

<img width="329" height="153" alt="image"
src="https://github.com/user-attachments/assets/b98ee5ba-a439-44d7-9ab5-f4511b66a574"
/>

<img width="464" height="40" alt="image"
src="https://github.com/user-attachments/assets/b41d9189-3475-4e61-b3a4-bc731dd52c53"
/>


Release Notes:

- Added a way to hide sidebar buttons
2026-05-08 10:36:03 +00:00
Lukas Wirth
c8f0026867
gpui: Remove unsound await_on_background helper (#56132)
The function is unsound due to the classic fact that one can leak tasks,
sidestepping the blocking drop behavior resulting in a use after free.

Release Notes:

- N/A or Added/Fixed/Improved ...
2026-05-08 09:30:34 +00:00
Conrad Irwin
be705e677b
Merge gpui::Task and scheduler::Task (#53674)
Release Notes:

- N/A or Added/Fixed/Improved ...
2026-05-05 22:41:13 +00:00
Mikhail Pertsev
1da60a8518
editor: Extract Diagnostics code out of editor.rs (#55747)
cc @SomeoneToIgnore

## Summary

Follow-up to https://github.com/zed-industries/zed/discussions/55352,
where the conclusion was to split `editor.rs` incrementally by topic
instead of all at once.

This mechanically extracts diagnostics-related editor code into
`crates/editor/src/editor/diagnostics.rs` while preserving the existing
public API via re-exports.

## Testing

- `cargo check -p editor --lib`
- `cargo check -p diagnostics --lib`
- `cargo check -p diagnostics --tests`

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-05 15:52:45 +00:00
Yara 🏳️‍⚧️
320888142f
Rust 1.95 (#55104)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A
2026-04-29 10:27:47 +00:00
Malin von Matern
9e2c493b86
Fix info colors used for hint diagnostics (#54046)
Super small update changing two instances where
`DiagnosticSeverity::HINT` was set to use the color for "info".

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #45637

Release Notes:

- Fixed various instances of hint level diagnostics using the color
designated for info
2026-04-20 08:53:15 +00:00
Om Chillure
82e7917e08
diagnostics: Hide Inline Assist toolbar button when agent is disabled (#52706)
### Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the UI/UX checklist
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

#### Closes #52702

### Video 

[Screencast from 2026-03-30
13-17-08.webm](https://github.com/user-attachments/assets/8b0f6927-04d2-406b-b7fd-064a730b2f86)

Release Notes:

- Fixed the Inline Assist button showing in the Project Diagnostics
toolbar when the agent is disabled.
2026-04-20 10:11:55 +02:00
Cole Miller
c998b4a053
diagnostics: Fall back to multibuffer_context_lines when syntactic expansion produces a single-line range (#53526)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-04-09 10:05:40 -04:00
Cole Miller
94ea487d4c
Fix stale buffer snapshot used in diagnostics multibuffer (#52937)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

Co-authored-by: Conrad <conrad@zed.dev>
2026-04-01 22:52:19 +00:00
Cole Miller
2a15bf630d
Require multibuffer excerpts to be ordered and nonoverlapping (#52364)
TODO:
- [x] merge main
- [x] nonshrinking `set_excerpts_for_path`
- [x] Test-drive potential problem areas in the app
- [x] prepare cloud side
- [x] test collaboration
- [ ] docstrings
- [ ] ???

## Context

### Background

Currently, a multibuffer consists of an arbitrary list of
anchor-delimited excerpts from individual buffers. Excerpt ranges for a
fixed buffer are permitted to overlap, and can appear in any order in
the multibuffer, possibly separated by excerpts from other buffers.
However, in practice all code that constructs multibuffers does so using
the APIs defined in the `path_key` submodule of the `multi_buffer` crate
(`set_excerpts_for_path` etc.) If you only use these APIs, the resulting
multibuffer will maintain the following invariants:

- All excerpts for the same buffer appear contiguously in the
multibuffer
- Excerpts for the same buffer cannot overlap
- Excerpts for the same buffer appear in order
- The placement of the excerpts for a specific buffer in the multibuffer
are determined by the `PathKey` passed to `set_excerpts_for_path`. There
is exactly one `PathKey` per buffer in the multibuffer

### Purpose of this PR

This PR changes the multibuffer so that the invariants maintained by the
`path_key` APIs *always* hold. It's no longer possible to construct a
multibuffer with overlapping excerpts, etc. The APIs that permitted
this, like `insert_excerpts_with_ids_after`, have been removed in favor
of the `path_key` suite.

The main upshot of this is that given a `text::Anchor` and a
multibuffer, it's possible to efficiently figure out the unique excerpt
that includes that anchor, if any:

```
impl MultiBufferSnapshot {
    fn buffer_anchor_to_anchor(&self, anchor: text::Anchor) -> Option<multi_buffer::Anchor>;
}
```

And in the other direction, given a `multi_buffer::Anchor`, we can look
at its `text::Anchor` to locate the excerpt that contains it. That means
we don't need an `ExcerptId` to create or resolve
`multi_buffer::Anchor`, and in fact we can delete `ExcerptId` entirely,
so that excerpts no longer have any identity outside their
`Range<text::Anchor>`.

There are a large number of changes to `editor` and other downstream
crates as a result of removing `ExcerptId` and multibuffer APIs that
assumed it.

### Other changes

There are some other improvements that are not immediate consequences of
that big change, but helped make it smoother. Notably:

- The `buffer_id` field of `text::Anchor` is no longer optional.
`text::Anchor::{MIN, MAX}` have been removed in favor of
`min_for_buffer`, etc.
- `multi_buffer::Anchor` is now a three-variant enum (inlined slightly):

```
enum Anchor {
    Min,
    Excerpt {
        text_anchor: text::Anchor,
        path_key_index: PathKeyIndex,
        diff_base_anchor: Option<text::Anchor>,
    },
    Max,
}
```

That means it's no longer possible to unconditionally access the
`text_anchor` field, which is good because most of the places that were
doing that were buggy for min/max! Instead, we have a new API that
correctly resolves min/max to the start of the first excerpt or the end
of the last excerpt:


```
impl MultiBufferSnapshot {
    fn anchor_to_buffer_anchor(&self, anchor: multi_buffer::Anchor) -> Option<text::Anchor>;
}
```
- `MultiBufferExcerpt` has been removed in favor of a new
`map_excerpt_ranges` API directly on `MultiBufferSnapshot`.

## Self-Review Checklist

<!-- Check before requesting review: -->
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
Co-authored-by: Conrad <conrad@zed.dev>
2026-04-01 17:25:32 +00:00
Xiaobo Liu
c5446117c1
markdown: Refactor code block copy button visibility to use enum (#52817)
Release Notes:

- N/A

---------

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Finn Evers <finn.evers@outlook.de>
Co-authored-by: MrSubidubi <finn@zed.dev>
2026-04-01 09:05:03 +00:00
Piotr Osiewicz
93e641166d
theme: Split out theme_settings crate (#52569)
Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A
2026-03-27 14:41:25 +01:00
João Soares
7b69324856
Truncate long diagnostic messages in the status bar (#51031)
Closes #50186

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)

## Screenshots:
### Before:
<img width="2543" height="39" alt="image"
src="https://github.com/user-attachments/assets/5e9fb7c5-0ba6-44b5-a0f6-1f63b35550f6"
/>

### After:
<img width="1165" height="581" alt="image"
src="https://github.com/user-attachments/assets/903bc637-7d38-48c5-9207-30e12eaa40de"
/>

Release Notes:

- Fixed long diagnostic messages in the status bar pushing right-side
buttons (terminal, agent, etc.) off screen
2026-03-12 18:25:52 +02:00
Kirill Bulatov
d788673f1e
Do not derive symbol highlights if they do not fit into multi buffer (#50948)
Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2026-03-09 15:50:44 +00:00
Piotr Osiewicz
97421c670e
Remove unreferenced dev dependencies (#51093)
This will help with test times (in some cases), as nextest cannot figure
out whether a given rdep is actually an alive edge of the build graph

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
2026-03-09 13:22:12 +01:00
Cole Miller
be5763632d
Start removing callers of legacy excerpt APIs (#50144)
Paving the way to remove `ExcerptId`. Done in this PR:

- Unshipped the stack trace view
- Get rid of `push_excerpts`
- Get rid of some callers of `remove_excerpts`

We still need to remove some calls to `remove_excerpts` and other APIs,
especially in `randomly_edit_excerpts` and collaboration.

Release Notes:

- The stack trace multibuffer view has been removed.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2026-02-26 10:37:43 -05:00
Grant Azure
9e0c5f42a9
diagnostics: Fix typo in toolbar controls (#49779)
Release Notes:

- Fixed typo in stop diagnostics update tooltip.
2026-02-20 23:46:34 -05:00
ozacod
fd32e31d56
editor: Add copy button for project diagnostics messages (#49671)
| Before | After |
|---|---|
| <img width="734" height="178" alt="before"
src="https://github.com/user-attachments/assets/1cea5854-e1b5-45a5-92ee-ed66bde06cc6"
/> | <img width="834" height="186" alt="after"
src="https://github.com/user-attachments/assets/bddb9280-89b3-4800-b9c9-08e456bc9ed8"
/> |

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 copy button for project diagnostics messages

---------

Co-authored-by: ozacod <ozacod@users.noreply.github.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-02-20 12:30:55 -03:00
Lukas Wirth
7d80412cca
Reduce amount of monomorphizations from FnMut closures (#49453)
Replaces a bunch of `impl FnMut` parameters with `&mut dyn FnMut` for
functions where this is the sole generic parameter.
Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-02-18 12:00:02 +01:00
Richard Feldman
ee3f40fe25
Re-add MultiWorkspace (#48800)
Release Notes:

- Added agent panel restoration. Now restarting your editor won't cause
your thread to be forgotten.

---------

Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
Co-authored-by: Eric Holk <eric@zed.dev>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Co-authored-by: Anthony Eid <anthony@zed.dev>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Co-authored-by: Cameron Mcloughlin <cameron.studdstreet@gmail.com>
2026-02-12 01:06:23 +00:00
Finn Evers
165b404460
Revert "New multi workspace (#47795)" (#48776)
Preparing this just in case.

Release Notes:

- N/A
2026-02-09 15:37:16 +01:00
Finn Evers
bdff8bf47c
Ensure proper workspace is used for various actions (#48767)
The multi workspace refactor **completely** broke the Vim mode, saving
is not possible, and various other actions. This PR fixes this

- [X] Code Reviewed
- [X] Manual QA

Release Notes:

- N/A
2026-02-09 10:33:36 +00:00
Marshall Bowers
438a820822
Clean up some Cargo.toml files (#48623)
This PR cleans up some `Cargo.toml` files after #48602.

Release Notes:

- N/A
2026-02-06 20:21:19 +00:00
Piotr Osiewicz
a8ae51cb97
build: Tear up crate graph (move terminal closer to editor) (#48602)
- **build: remove assistant_slash_commands dependency in
assistant_text_thread**
- **diagnostics: Do not depend on search**
- **Remove terminal_view's dependency on search**
- **sever breadcrumbs <-> editor dep (for the sake of terminal_view)**

Release Notes:

- N/A
2026-02-06 20:14:35 +01:00
Carl Jackson
1ded60a660
Implement Vim's tag stack (#46002)
Happy New Years! This PR is a second take at
https://github.com/zed-industries/zed/pull/38127 (cc @ConradIrwin)

This PR is significantly less complicated than the last attempt: while
we still keep our data on the `NavigationHistory` object, we no longer
tightly integrate it with the existing back/forward "browser history."
Instead, we keep our own stack of `(origin, target)` pairs (in a struct
to make it easy to extend with e.g., tag names in the future).

The PR is split into two separable commits. Most of the implementation
is in the second commit, which:
- Defines the stack data structure
- Implements `pane::GoToOlderTag` and `pane::GoToNewerTag` in terms of
the stack
- Hooks into `navigate_to_hover_links` to push tag stack entries

This last bit is the most fiddly. The core challenge is that we need to
keep track of the `origin` location and calculate the `target` location
across three codepaths that might involve creating a new editor and/or
splitting the pane. One thing in particular I found difficult was that
an editor's `nav_history` (an `ItemNavHistory`) seems to be populated
asynchronously. Instead of relying on it, I decided in this code to make
my own `ItemNavHistory`. I briefly tried to refactor the code in
question, but it seemed like it would significantly increase the scope
of the change.

I prefer this all-in-one tracking centered around
`navigate_to_hover_links ` to the `start/finish` approach taken in
b69a2ea200
because I find it easier to convince myself that the right data is being
populated at the right times. Of course, let me know if you think
there's a better solution.

Closes #14206

Release Notes:
- ??? I don't know what to write here! Suggestions welcome
2026-01-15 17:48:15 +00:00
Mikayla Maki
97c35c084b
gpui: Actually remove the Result from AsyncApp (#45809)
Depends on: https://github.com/zed-industries/zed/pull/45768

Refactor plan:
https://gist.github.com/mikayla-maki/6c4bf263fd80050715ba01f45478796e
Overall plan:
https://gist.github.com/mikayla-maki/7bb5078e4385a2e683e1e1eb40d17d38

This is the big one.

Release Notes:

- N/A

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 12:48:24 -08:00
KyleBarton
216933f0b8
Multibuffer breadcrumbs toolbar redesign (#45547)
Breadcrumb visual reorchestration which makes a couple of key changes:
- Breadcrumbs are now displayed in file headers for multibuffer views.
Singleton buffers are unchanged.
- Multibuffer views now have collapse/expand all buttons available in
the toolbar
- Search in multibuffer views now takes up less space, by occupying the
primary toolbar location erstwhile taken up by breadcrumbs

<img width="1721" height="823" alt="Screenshot 2025-12-22 at 4 15 41 PM"
src="https://github.com/user-attachments/assets/38e924f7-fe9e-4c83-84fb-2eee98137f43"
/>

<img width="1722" height="762" alt="Screenshot 2025-12-22 at 4 15 51 PM"
src="https://github.com/user-attachments/assets/ccc98ca3-75ce-4aca-bceb-890817b0f04d"
/>


Release Notes:

- Moved breadcrumbs to file headers in multibuffer views
- Added collapse/expand all options for multibuffer views
- Improved use of space for multibuffer search by taking the place of
the former breadcrumb toolbar location

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-01-06 09:42:00 -03:00
Lukas Wirth
9cdb986fd4
workspace: Fix read-only pane buttons being clickable even when a no-op (#46065)
The button was clickable for read-only panes even if the underlying item
is not write-toggleable.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-01-05 10:27:46 +00:00
Lukas Wirth
dba13522d6
worktree: Implement read_only_files worktree setting (#44376)
This mimics VSCode's `files.readonlyExclude` setting, to allow setting
specific path matches as readonly locations like lockfiles and generated
sources etc.

Also renders a lock icon to the right side of the path names for
readonly files now.
This does a couple more things for completion sake:
- Tabs of readonly buffers now render a file lock icon
- Multibuffer buffer headers now render a file lock icon if the excerpts
buffer is readonly
- ReadWrite multibuffers now no longer allow edits to read only buffers
contained within

Release Notes:

- Added `read_only_files` setting to allow specifying glob patterns of
files that should not be editable by default

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-01-04 13:18:34 +00:00
Xipeng Jin
f084e20c56
Fix stale pending keybinding indicators on focus change (#44678)
Closes #ISSUE

Problem:

- The status bar’s pending keystroke indicator (shown next to --NORMAL--
in Vim mode) didn’t clear when focus moved to another context, e.g.
hitting g in the editor then clicking the Git panel. The keymap state
correctly canceled the prefix, but observers that render the indicator
never received a “pending input changed” notification, so the UI kept
showing stale prefixes until a new keystroke occurred.

Fix:

- The change introduces a `pending_input_changed_queued` flag and a new
helper `notify_pending_input_if_needed` which will flushes the queued
notification as soon as we have an App context. The
`pending_input_changed` now resets the flag after notifying subscribers.

Before:


https://github.com/user-attachments/assets/7bec4c34-acbf-42bd-b0d1-88df5ff099aa

After:



https://github.com/user-attachments/assets/2264dc93-3405-4d63-ad8f-50ada6733ae7



Release Notes:

- Fixed: pending keybinding prefixes on the status bar now clear
immediately when focus moves to another panel or UI context.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-12-17 16:51:16 +00:00
lif
37bd27b2a8
diagnostics: Respect toolbar breadcrumbs setting in diagnostics panel (#44974)
## Summary

The diagnostics panel was ignoring the user's `toolbar.breadcrumbs`
setting and always showing breadcrumbs. This makes both
`BufferDiagnosticsEditor` and `ProjectDiagnosticsEditor` check the
`EditorSettings` to determine whether to display breadcrumbs.

## Changes

- `buffer_diagnostics.rs`: Updated `breadcrumb_location` to check
`EditorSettings::get_global(cx).toolbar.breadcrumbs`
- `diagnostics.rs`: Updated `breadcrumb_location` to check
`EditorSettings::get_global(cx).toolbar.breadcrumbs`

This follows the same pattern used by the regular `Editor` in
`items.rs`.

## Test plan

1. Set `toolbar.breadcrumbs` to `false` in settings.json
2. Open a file with diagnostics
3. Run `diagnostics: deploy current file`
4. Verify that breadcrumbs are hidden in the diagnostics panel

Fixes #43020
2025-12-16 13:05:31 +00:00
Lukas Wirth
5a6198cc39
language: Spawn language servers on background threads (#44631)
Closes https://github.com/zed-industries/zed/issues/39056

Leverages a new `await_on_background` API that spawns the future on the
background but blocks the current task, allowing to borrow from the
surrounding scope.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2025-12-11 17:23:27 +00:00
Cole Miller
2e00f40c54
Basic side-by-side diff implementation (#43586)
Release Notes:

- N/A

---------

Co-authored-by: cameron <cameron.studdstreet@gmail.com>
Co-authored-by: Cameron <cameron@zed.dev>
2025-11-30 22:45:01 -05:00
Lukas Wirth
fafe1afa61
multi_buffer: Remove redundant buffer id field (#43459)
It is easy for us to get the two fields out of sync causing weird
problems, there is no reason to have both here so.

Release Notes:

- N/A *or* Added/Fixed/Improved ...

Co-authored by: Antonio Scandurra <antonio@zed.dev>
2025-11-25 17:13:16 +01:00
Lukas Wirth
29f9853978
svg_preview: Remove unnecessary dependency on editor (#43147)
Editor is a choke point in our compilation graph while also being a very
common crate that is being edited. So reducing things that depend on it
will generally improve compilation times for us.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2025-11-20 12:18:50 +01:00
Lukas Wirth
c98b2d6944
multi_buffer: Typed MultiBufferOffset (#42707)
This PR introduces a new `MultiBufferOffset` new type wrapping size. The
goal of this is to make it clear at the type level when we are
interacting with offsets of a multi buffer versus offsets of a language
/ text buffer. This improves readability of things quite a bit by making
it clear what kind of offsets one is working with while also reducing
accidental bugs by using the wrong kin of offset for the wrong API.

This PR also uncovered two minor bugs due to that.

Does not yet introduce the MultiBufferPoint equivalent, that is for a
follow up PR.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2025-11-19 22:00:58 +00:00
Lukas Wirth
2c7bcfcb7b
multi_buffer: Work around another panic bug in path_key (#42920)
Fixes ZED-346 for now until I find the time to dig into this bug
properly

Release Notes:

- Fixed a panic in the diagnostics pane
2025-11-17 22:38:48 +00:00
KyleBarton
4adec27a3d
Implement pretty TypeScript errors (#42494)
Closes #7844

This change uses tree-sitter highlights as a method of showing
typescript errors prettily, keeping regex as simple as possible:

<img width="832" height="446" alt="Screenshot 2025-11-11 at 3 40 24 PM"
src="https://github.com/user-attachments/assets/0b3b6cf1-4d4d-4398-b89b-ef5ec0df87ec"
/>

It covers three main areas:

1. Diagnostics

Diagnostics are now rendered with language-aware typescript, by
providing the project's language registry.

2. Vtsls

The LSP provider for typescript now implements the
`diagnostic_message_to_markdown` function in the `LspAdapter` trait, so
as to provide Diagnostics with \`\`\`typescript...\`\`\`-style code
blocks for any selection of typescript longer than one word. In the
single-word case, it simply wraps with \`\`

3. Typescript's `highlights.scm`

`vtsls` doesn't provide strictly valid typescript in much of its
messaging. Rather, it returns a message with snippets of typescript
values which are invalid. Tree-sitter was not properly highlighting
these snippets because it was expecting key-value formats. For instance:
```
type foo = { foo: string; bar: string; baz: number[] }
```
is valid, whereas simply
```
{ foo: string; bar: string; baz: number[] }
```
is not.

Therefore, highlights.scm needed to be adjusted in order to
pattern-match on literal values that might be returned from the vtsls
diagnostics messages. This was done by a) identifying arrow functions on
their own, and b) augmenting the `statment_block` pattern matching in
order to match on values which were clearly object literals.

This approach may not be exhaustive - I'm happy to work on any
additional cases we might identify from `vtsls` here - but hopefully
demonstrates an extensible approach to making these messages look nice,
without taking on the technical burden of extensive regex.

Release Notes:

- Show pretty TypeScript errors with language-aware Markdown.
2025-11-12 10:32:46 -08:00
Lukas Wirth
231d1b1d58
diagnostics: Close diagnosticsless buffers on refresh (#42503)
Release Notes:

- N/A *or* Added/Fixed/Improved ...
2025-11-12 08:11:50 +00:00
Lukas Wirth
46db753f79
diagnostics: Fix panic due non-sorted diagnostics excerpt ranges (#42416)
Fixes ZED-356

Release Notes:

- N/A *or* Added/Fixed/Improved ...

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2025-11-11 09:57:11 +01:00
Lukas Wirth
b7d4d1791a
diagnostics: Keep diagnostic excerpt ranges properly ordered (#42298)
Fixes ZED-2CQ

We were doing the binary search by buffer points, but due to await
points within this function we could end up mixing points of differing
buffer versions.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2025-11-09 10:55:56 +00:00
Mikayla Maki
5f8226457e
Automate settings registration (#42238)
Release Notes:

- N/A

---------

Co-authored-by: Nia <nia@zed.dev>
2025-11-07 22:27:14 +00:00
Lukas Wirth
3c19174f7b
diagnostics: Fix diagnostics view no clearing blocks correctly (#42179)
Release Notes:

- N/A *or* Added/Fixed/Improved ...
2025-11-07 11:16:25 +00:00
Lukas Wirth
88a8e53696
editor: Remove buffer and display map fields from SelectionsCollection (#42175)
Release Notes:

- N/A *or* Added/Fixed/Improved ...
2025-11-07 11:21:14 +01:00
Lukas Wirth
5fc54986c7
Revert "sum_tree: Replace rayon with futures (#41586) (#41846)
This causes the background executor to hang

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2025-11-03 19:25:15 +00:00
Lukas Wirth
73366bef62
diagnostics: Live update diagnostics view on edits while focused (#41829)
Prior we were only updating the diagnostics pane when it is either
unfocued, saved or when a disk based diagnostic run finishes (aka cargo
check). The reason for this is simple, we do not want to take away the
excerpt under the users cursor while they are typing if they manage to
fix the diagnostic. Additionally we need to prevent dropping the changed
buffer before it is saved.

Delaying updates was a simple way to work around these kind of issues,
but comes at a huge annoyance that the diagnostics pane is not actually
reflecting the current state of the world but some snapshot of it
instead making it less than ideal to work within it for languages that
do not leverage disk based diagnostics (that is not rust-analyzer, and
even for rust-analyzer its annoying).

This PR changes this. We now always live update the view but take care
to retain unsaved buffers as well as buffers that contain a cursor in
them (as well as some other "checkpoint" properties).

Release Notes:

- Improved diagnostics pane to live update when editing within its
editor
2025-11-03 16:16:05 +00:00
Lukas Wirth
f2ce06c7b0
sum_tree: Replace rayon with futures (#41586)
Release Notes:

- N/A *or* Added/Fixed/Improved ...

Co-authored by: Kate <kate@zed.dev>
2025-10-31 10:39:01 +00:00
Lukas Wirth
fd3ca0303f
workspace: Handle non-cloneable items better (#41215)
When trying to split and clone a non clone-able workspace item we now
attempt split and move instead of doing nothing. Additionally we disable
the split menu buttons if we can't split the active item at all.

Release Notes:

- Improved handling of unsplittable panes
2025-10-26 13:24:26 +00:00
Lukas Wirth
33ec545d1f
workspace: Make Item::clone_on_split async (#41211)
Split out from https://github.com/zed-industries/zed/pull/40774 to
reduce the size of the reland of that PR (once I figure out the cause of
the issue)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2025-10-26 08:46:37 +00:00