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):

Release Notes:
- Text entered in a new untitled buffer is considered as the default
filename when saving
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.
1. Extension loaded events are now condensed into a single event with a
Vec of (extension_id, extension_version) called id_and_versions.
2. Editor Saved & AutoSaved are merged into a singular event with a type
field that is either "manual" or "autosave”.
3. Editor Edited event will only fire once every 10 minutes now.
4. Editor Closed event is fired when an editor item (tab) is removed
from a pane
cc: @katie-z-geer
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Closes#33342
This PR implements serialization of pinned tabs regardless of their
state (empty, untitled, etc.)
The root cause was that empty untitled tabs were being skipped during
serialization but their pinned state was still being persisted, leading
to a mismatch between the stored pinned count and actual restorable
tabs, this issue lead to a crash which was patched by @JosephTLyons, but
this PR aims to be a proper fix.
**Note**: I'm still evaluating the best approach for this fix. Currently
exploring whether it's necessary to store the pinned state in the
database schema or if there's a simpler solution that doesn't require
schema changes.
---
**Edit from Joseph**
We ended up going with altering our recall logic, where we always
restore all editors, even those that are new, empty, and unsaved. This
prevents the crash that #33335 patched because we are no longer skipping
the restoration of pinned editors that have no text and haven't been
saved, throwing off the count dealing with the number of pinned items.
This solution is rather simple, but I think it's fine. We simply just
restore everything the same, no conditional dropping of anything. This
is also consistent with VS Code, which also restores all editors,
regardless of whether or not a new, unsaved buffers have content or not.
https://github.com/zed-industries/zed/tree/alt-solution-for-%2333342
Release Notes:
- N/A
---------
Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
In #32656 I generalized the argument to change selections to allow
controling both the scroll and the nav history (and the completion
trigger).
To avoid conflicting with ongoing debugger cherry-picks I left the
argument as an `impl Into<>`, but I think it's clearer to make callers
specify what they want here.
I converted a lot of `None` arguments to `SelectionEffects::no_scroll()`
to be exactly compatible; but I think many people used none as an "i
don't care" value in which case Default::default() might be more
appropraite
Closes #ISSUE
Release Notes:
- N/A
In #32656 I generalized the argument to change selections to allow
controling both the scroll and the nav history (and the completion
trigger).
To avoid conflicting with ongoing debugger cherry-picks I left the
argument as an `impl Into<>`, but I think it's clearer to make callers
specify what they want here.
I converted a lot of `None` arguments to `SelectionEffects::no_scroll()`
to be exactly compatible; but I think many people used none as an "i
don't care" value in which case Default::default() might be more
appropraite
From
https://github.com/zed-industries/zed/pull/10831#issuecomment-2078523272
> I agree with not prefilling the search bar with a multiline query.
Not sure if it's a bug that a one-line visual line selection does not
get pre filled, this PR corrects the query to use the visual line
selection instead of the 'normal' selection
Release Notes:
- N/A
Closes#23527Closes#30183
Closes some Discord chats
Release Notes:
- vim: Motions now push to the jump list using the same logic as vim
(i.e.
`G`/`g g`/`g d` always do, but `j`/`k` always don't). Most non-vim
actions
(including clicking with the mouse) continue to push to the jump list
only
when they move the cursor by 10 or more lines.
- [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.
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
Open inspector with `dev: toggle inspector` from command palette or
`cmd-alt-i` on mac or `ctrl-alt-i` on linux.
https://github.com/user-attachments/assets/54c43034-d40b-414e-ba9b-190bed2e6d2f
* Picking of elements via the mouse, with scroll wheel to inspect
occluded elements.
* Temporary manipulation of the selected element.
* Layout info and JSON-based style manipulation for `Div`.
* Navigation to code that constructed the element.
Big thanks to @as-cii and @maxdeviant for sorting out how to implement
the core of an inspector.
Release Notes:
- N/A
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Co-authored-by: Federico Dionisi <code@fdionisi.me>
https://github.com/zed-industries/zed/issues/30972 brought up another
case where our context is not enough to track the actual source of the
issue: we get a general top-level error without inner error.
The reason for this was `.ok_or_else(|| anyhow!("failed to read HEAD
SHA"))?; ` on the top level.
The PR finally reworks the way we use anyhow to reduce such issues (or
at least make it simpler to bubble them up later in a fix).
On top of that, uses a few more anyhow methods for better readability.
* `.ok_or_else(|| anyhow!("..."))`, `map_err` and other similar error
conversion/option reporting cases are replaced with `context` and
`with_context` calls
* in addition to that, various `anyhow!("failed to do ...")` are
stripped with `.context("Doing ...")` messages instead to remove the
parasitic `failed to` text
* `anyhow::ensure!` is used instead of `if ... { return Err(...); }`
calls
* `anyhow::bail!` is used instead of `return Err(anyhow!(...));`
Release Notes:
- N/A
## Overview
This PR adds the minimap feature to the Zed editor, closely following
the [design from Visual Studio
Code](https://code.visualstudio.com/docs/getstarted/userinterface#_minimap).
When configured, a second instance of the editor will appear to the left
of the scrollbar. This instance is not interactive and it has a slimmed
down set of annotations, but it is otherwise just a zoomed-out version
of the main editor instance. A thumb shows the line boundaries of the
main viewport, as well as the progress through the document. Clicking on
a section of code in the minimap will jump the editor to that code.
Dragging the thumb will act like the scrollbar, moving sequentially
through the document.

## New settings
This adds a `minimap` section to the editor settings with the following
keys:
### `show`
When to show the minimap in the editor.
This setting can take three values:
1. Show the minimap if the editor's scrollbar is visible: `"auto"`
2. Always show the minimap: `"always"`
3. Never show the minimap: `"never"` (default)
### `thumb`
When to show the minimap thumb.
This setting can take two values:
1. Show the minimap thumb if the mouse is over the minimap: `"hover"`
2. Always show the minimap thumb: `"always"` (default)
### `width`
The width of the minimap in pixels.
Default: `100`
### `font_size`
The font size of the minimap in pixels.
Default: `2`
## Providing feedback
In order to keep the PR focused on development updates, please use the
discussion thread for feature suggestions and usability feedback: #26894
## Features left to add
- [x] fix scrolling performance
- [x] user settings for enable/disable, width, text size, etc.
- [x] show overview of visible lines in minimap
- [x] clicking on minimap should navigate to the corresponding section
of code
- ~[ ] more prominent highlighting in the minimap editor~
- ~[ ] override scrollbar auto setting to always when minimap is set to
always show~
Release Notes:
- Added minimap for high-level overview and quick navigation of editor
contents.
---------
Co-authored-by: MrSubidubi <dev@bahn.sh>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Nathan here: I also tacked on a bunch of UI refinement.
Release Notes:
- Introduced the ability to follow the agent around as it reads and
edits files.
---------
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
resolves#24655resolves#23945
I haven't yet added a default binding for the new command. #27797 added `:ls` and
`:buffers` which in my opinion should use the global searchable version
given that that matches the vim semantics of those commands better than
just showing the tabs in the local pane.
There's also a question of what to do when you select a tab from another
pane, should the focus jump to that pane or should that tab move to the
currently focused pane? For now I've implemented the former.
Release Notes:
- Added `tab_switcher::ToggleAll` to search open tabs from all panes and focus the selected one.
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Part of https://github.com/zed-industries/zed/issues/16472
* Adds debug logging to everywhere near INSERT/UPDATEs in the DB
So something like
`env RUST_LOG=debug,wasmtime_cranelift=off,cranelift_codegen=off,vte=off
cargo run` could be used to view these (current zlog seems to process
the exclusions odd, so not sure this is the optimal RUST_LOG line) can
be used to debug any further writes.
* Removes excessive window stack serialization
Previously, it serialized unconditionally every 100ms.
Now, only if the stack had changed, which is now check every 500ms.
* Removes excessive terminal serialization
Previously, it serialized its `cwd` on every `ItemEvent::UpdateTab`
which was caused by e.g. any character output.
Now, only if the `cwd` has changed at the next event processing time.
Release Notes:
- Fixed more excessive DB writes
WIP!
In light of having more control over blame popover from editor.
This fixes: https://github.com/zed-industries/zed/issues/28645,
https://github.com/zed-industries/zed/issues/26304
- [x] Initial rendering
- [x] Handle smart positioning (edge detection, etc)
- [x] Delayed hovering, release, etc
- [x] Test blame message selection
- [x] Fix tagged issues
Release Notes:
- Git inline blame popover now dismisses when the cursor is moved, the
editor is scrolled, or the command palette is opened.
TODO:
- [x] Make it work in the project diff:
- [x] Support non-singleton buffers
- [x] Adjust excerpt boundaries to show full conflicts
- [x] Write tests for conflict-related events and state management
- [x] Prevent hunk buttons from appearing inside conflicts
- [x] Make sure it works over SSH, collab
- [x] Allow separate theming of markers
Bonus:
- [ ] Count of conflicts in toolbar
- [ ] Keyboard-driven navigation and resolution
- [ ] ~~Inlay hints to contextualize "ours"/"theirs"~~
Release Notes:
- Implemented initial support for resolving merge conflicts.
---------
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Before this change, when syncing a multibuffer (such as
find-all-references) to a remote, we would renumber the excerpts from 1.
This did not matter in the past because the buffers' list of excerpts
could not change. In #27876, I added the ability for excerpts to merge,
which meant that the excerpt list could change. This manifested as
people seeing "invalid excerpt id" panics when syncing.
The initial fix to this (to re-use the excerpt ids from the host) ran
into problems because `insert_excerpts_with_ids_after` assumes that you
call it in excerpt-id order. This change de-optimizes that code to
insert the excerpts 1-by-1 in excerpt-id order, but with the
insert_after set to preserve the correct UI order.
I hope to soon remove this code path and use something more like
set-excerpts-for-path for syncing, but in the meantime we should not
panic.
Release Notes:
- Fix a panic when joining a project with a multibuffer with merged
excerpts
Closes#28787
The context menu appears before the modal because it is a Deferred
element, which is always displayed above normal elements.
Release Notes:
Previously, the editor context menu appeared before the Command Palette.
This commit ensures the editor context menu is hidden when a modal,
including the Command Palette, is opened.
This Pull Request updates the default behavior of the substitute (`s`)
command in vim mode to only replace the next match by default, instead
of all, and replace all matches only when the `g` flag is provided,
making it more similar to NeoVim's behavior.
In order to achieve this, the following changes were introduced:
- Update `BufferSearchBar::replace_next` to be a public method, so it
can be called from `Vim::replace_command` .
- Update the `Replacement::parse` to set the `should_replace_all` field
to `false` by default, and only set it to `true` if the `'g'` flag is
present in the query.
- Add support for when the `Replacement.should_replace_all` is set to
`false` in `Vim::replace_command`, so as to have it only replace the
next occurrence instead of all occurrences in the line.
- Introduce `BufferSearchBar::select_first_match` so as to activate the
first match on the line under the cursor.
Closes#24450
Release Notes:
- Improved vim's substitute command so as to only replace the first
match by default, and replace all matches if the `'g'` flag is provided
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
We cannot compare versions and anchors between different `Buffer`s with
different `BufferId`s.
Release Notes:
- Fixed Zed panicking on editor reopen
Co-authored-by: Conrad Irwin <conrad@zed.dev>
Closes https://github.com/zed-industries/zed/issues/11626
Part of https://github.com/zed-industries/zed/issues/12853
`"restore_on_file_reopen": true` in workspace settings can now be used
to enable and disable editor data between file reopens in the same pane:
https://github.com/user-attachments/assets/8d938ee1-d854-42a8-bbc3-2a4e4d7d5933
The settings are generic and panes' data store can be extended for
further entities, beyond editors.
---------------
Impl details:
Currently, the project entry IDs seem to be stable across file reopens,
unlike BufferIds, so those were used.
Originally, the DB data was considered over in-memory one as editors
serialize their state anyway, but managing and exposing PaneIds out of
the DB is quite tedious and joining the DB data otherwise is not
possible.
Release Notes:
- Started to restore editor state on reopen
Closes#22398
Release Notes:
- vim: Adds `'` and `"` marks (last location jumped from in the current
buffer, and location when last exiting a buffer)
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This PR fixes the new awkward-looking git status labels due to the
change in version control colors. We want to enable styling version
control colors distinctly from other statuses, but these colors aren't
great for labels as they are meant to be quite high contrast.
We may need to split version control colors into a primary color and a
text color if we want to improve theming this overall.
| Before | After |
|--------|-------|
| 
| 
|
Release Notes:
- Fixes a regression in git status colors in the project panel
This is a pure refactoring PR that goes through all the git-related APIs
exposed by the worktree crate and minimizes their use outside that
crate, migrating callers of those APIs to read from the GitStore
instead. This is to prepare for evacuating git repository state from
worktrees and making the GitStore the new source of truth.
Other drive-by changes:
- `project::git` is now `project::git_store`, for consistency with the
other project stores
- the project panel's test module has been split into its own file
Release Notes:
- N/A
---------
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Closes#26847
Release Notes:
- Updated Git panel background to use panel_background instead of
ElevationIndex::Surface.bg(cx) for consistency with other panels.
- Removed redundant GitStatusColors struct from status.rs and refactored
to use existing theme colors.
- Adjusted Color enum mappings in color.rs to reference
version_control_* colors instead of status() for better alignment with
the theme system.
- Cleaned up unused or redundant code.
This is the core change:
https://github.com/zed-industries/zed/pull/26758/files#diff-044302c0d57147af17e68a0009fee3e8dcdfb4f32c27a915e70cfa80e987f765R1052
TODO:
- [x] Use AsyncFn instead of Fn() -> Future in GPUI spawn methods
- [x] Implement it in the whole app
- [x] Implement it in the debugger
- [x] Glance at the RPC crate, and see if those box future methods can
be switched over. Answer: It can't directly, as you can't make an
AsyncFn* into a trait object. There's ways around that, but they're all
more complex than just keeping the code as is.
- [ ] Fix platform specific code
Release Notes:
- N/A
Release Notes:
- Multibuffers now use less vertical space for excerpt boundaries.
Additionally the expand up/down arrows are hidden at the start and end
of the buffers
---------
Co-authored-by: Nate Butler <iamnbutler@gmail.com>
Co-authored-by: Zed AI <claude-3.5-sonnet@zed.dev>
Modified version of #25950. We still use worktree paths, but repo paths
with a status that lie outside the worktree are not excluded; instead,
we relativize them by adding `..`. This makes the list in the git panel
match what you'd get from running `git status` (with the repo's worktree
root as the working directory).
- [x] Implement + test new unrelativization logic
- [x] ~~When collecting repositories, dedup by .git abs path, so
worktrees can share a repo at the project level~~ dedup repos at the
repository selector layer, with repos coming from larger worktrees being
preferred
- [x] Open single-file worktree with diff when activating a path not in
the worktree
Release Notes:
- N/A
This solves a couple of issues with Vim search by making the search
buffer and `SearchableItem` aware of the direction of the search. If
`SearchOptions::BACKWARDS` is set, all operations will be reversed. By
making `SearchableItem` aware of the direction, the correct active match
can be selected when searching backward.
Fixes#22506. This PR does not fix the last problem in that issue, but
that one is also tracked in #8049.
Release Notes:
- Fixes incorrect behavior of backward search in Vim mode
Closes#25885
This PR improves the matching for file icons to tabs.
Previously, the tab icon would be resolved based upon the relative path
in the current project. However, this caused the default file icon being
assigned to all files outside of the project, as the relative path for
these files would be empty.
Instead, `path_for_buffer` is now used which always returns a proper
file name even for paths outside the current project (as also stated [in
this
comment](fee9c67707/crates/editor/src/items.rs (L1689))).
As the file name is sufficient for matching icons to files, this fixes
the linked issue whilst not changing anything for previously properly
matched icons.
| `main` | This PR |
| --- | --- |
| <img width="296" alt="main"
src="https://github.com/user-attachments/assets/e72b8b5d-aa1c-4a8e-903f-14239f5b8764"
/> | <img width="296" alt="PR"
src="https://github.com/user-attachments/assets/a736974a-ce41-4861-be3f-95448cc7ffd0"
/> |
Release Notes:
- Fixed wrong file icons being shown for files outside of the current
project.