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
- [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 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
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
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
Follow-up of https://github.com/zed-industries/zed/pull/19230
* starts to send `result_id` in pull requests to allow servers to reply
with non-full results
* fixes a bug where disk-based diagnostics were offset after pulling the
diagnostics
* fixes a bug due to which pull diagnostics could not be disabled
* uses better names and comments for the workspace pull diagnostics part
Release Notes:
- N/A
Closes#31648
This PR adds support for:
- Expanding multiple cursors above/below
- Expanding multiple selections above/below
- Adding new cursors/selections when expansion has already been done.
Existing expansions preserve their state and expand/shrink according to
the action, while new cursors/selections act like freshly created ones.
Tests for both cursor and selections:
- below/above cases
- undo/redo cases
- adding new cursors/selections with existing expansion
Before/After:
https://github.com/user-attachments/assets/d2fd556b-8972-4719-bd86-e633d42a1aa3
Release Notes:
- Improved `AddSelectionAbove` and `AddSelectionBelow` to extend
multiple cursors/selections.
Closes [#13107](https://github.com/zed-industries/zed/issues/13107)
Enabled pull diagnostics by default, for the language servers that
declare support in the corresponding capabilities.
```
"diagnostics": {
"lsp_pull_diagnostics_debounce_ms": null
}
```
settings can be used to disable the pulling.
Release Notes:
- Added support for the LSP `textDocument/diagnostic` command.
# Brief
This is draft PR that implements the LSP `textDocument/diagnostic`
command. The goal is to receive your feedback and establish further
steps towards fully implementing this command. I tried to re-use
existing method and structures to ensure:
1. The existing functionality works as before
2. There is no interference between the diagnostics sent by a server and
the diagnostics requested by a client.
The current implementation is done via a new LSP command
`GetDocumentDiagnostics` that is sent when a buffer is saved and when a
buffer is edited. There is a new method called `pull_diagnostic` that is
called for such events. It has debounce to ensure we don't spam a server
with commands every time the buffer is edited. Probably, we don't need
the debounce when the buffer is saved.
All in all, the goal is basically to get your feedback and ensure I am
on the right track. Thanks!
## References
1.
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics
## In action
You can clone any Ruby repo since the `ruby-lsp` supports the pull
diagnostics only.
Steps to reproduce:
1. Clone this repo https://github.com/vitallium/stimulus-lsp-error-zed
2. Install Ruby (via `asdf` or `mise).
4. Install Ruby gems via `bundle install`
5. Install Ruby LSP with `gem install ruby-lsp`
6. Check out this PR and build Zed
7. Open any file and start editing to see diagnostics in realtime.
https://github.com/user-attachments/assets/0ef6ec41-e4fa-4539-8f2c-6be0d8be4129
---------
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Release Notes:
- Improved the review experience in the agent panel. Now, when you
commit changes (generated by the AI agent) using Git, Zed will
automatically dismiss the agent’s review UI for those changes. This
means you won’t have to manually “keep” or approve changes twice—just
commit, and you’re done.
Closes https://github.com/zed-industries/zed/discussions/25526
Follow up of #29872
Release Notes:
- Make `alt-left` and `alt-right` skip punctuation on Mac OS to respect
the Mac default behaviour. When pressing alt-left and the first
character is a punctuation character like a dot, this character should
be skipped. For example: `hello.|` goes to `|hello.`
This change makes the editor feels much snappier, it now follows the
same behaviour as VSCode and any other Mac OS native application.
@ConradIrwin
Also adds reuse of the markdown documentation cache even when
completions are re-queried, so that markdown documentation doesn't
flicker when `is_incomplete: true` (completions provided by rust
analyzer always set this)
Release Notes:
- Added support for filtering language server completions instead of
re-querying.
Closes#26957
Release Notes:
- Fix an edge case where indent guides would be rendered incorrectly if
lines consisted of entirely whitespace
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Closes#31662
Currently, we assume `insert_range` will always end at the cursor and
`replace_range` will also always end after the cursor for calculating
range to replace. This is a particular case for the rust-analyzer, but
not widely true for other language servers.
This PR fixes this assumption, and now `insert_range` and
`replace_range` both can end before cursor.
In this particular case:
```ts
let x: string | undefined;
x.tostˇ // here insert as well as replace range is just "." while new_text is "?.toString()"
```
This change makes it such that if final range to replace ends before
cursor, we extend it till the cursor.
Bonus:
- Improves suffix and subsequence matching to use `label` over
`new_text` as `new_text` can contain end characters like `()` or `$`
which is not visible while accepting the completion.
- Make suffix and subsequence check case insensitive.
- Fixes broken subsequence matching which was not considering the order
of characters while matching subsequence.
Release Notes:
- Fixed an issue where autocompleting optional chaining methods in
TypeScript, such as `x.tostr`, would result in `x?.toString()tostr`
instead of `x?.toString()`.
This PR adds a comprehensive test that ensures that no item-closing
action will panic when no items are present. A test already existed
(`test_remove_active_empty `) that ensured `CloseActiveItem` didn't
panic, but the new test covers:
- `CloseActiveItem`
- `CloseInactiveItems`
- `CloseAllItems`
- `CloseCleanItems`
- `CloseItemsToTheRight`
- `CloseItemsToTheLeft`
I plan to do a bit more clean up in `pane.rs` and this feels like a good
thing to add before that.
Release Notes:
- N/A
Closes https://github.com/zed-industries/zed/issues/31565
* Looking up settings on every row was very slow in the case of large
folds, especially if there was an `.editorconfig` file with numerous
glob patterns
* Checking whether each indent guide was within a fold was very slow,
when a fold spanned many indent guides.
Release Notes:
- Fixed slowness that could happen when editing in the presence of large
folds.
* stopped fetching LSP tasks for too long (but still use the hardcoded
value for the time being — the LSP tasks settings part is a simple bool
key and it's not very simple to fit in another value there)
* introduced `prefer_lsp` language task settings value, to control
whether in the gutter/modal/both/none LSP tasks are shown exclusively,
if possible
Release Notes:
- Added a way to prefer LSP tasks over Zed tasks
Follow-up to #29625 and #30902
This PR reintroduces auto-intents for brackets in Python and fixes some
cases where an indentation would be triggered if it should not. For
example, upon typing
```python
a = []
```
and inserting a newline after, the next line would be indented although
it shoud not be.
Bracket auto-indentation was tested prior to #29625 but removed there
and the test updated accordingly. #30902 reintroduced this for all
brackets but `()`. I reintroduced this here, reverted the changes to the
test so that indents also happen after typing `()`. This is frequently
used for tuples and multiline statements in Python.
Release Notes:
- Improved auto-indentation when using round brackets in Python.
Release Notes:
- Fixed issue where pressing Enter on a line starting with * incorrectly
added comment delimiter.
---------
Co-authored-by: Piotr Osiewicz <peterosiewicz@gmail.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Closes#31138
Fix edge case where adding newline if there is text afterwards end
delimiter of multiline comment, would continue the comment prefix. This
is fixed by checking for end delimiter on whole line instead of just
assuming it would always be at end.
- [x] Tests
Release Notes:
- Fixed the issue where in some cases the block comment continues to the
next line even though the comment block is already closed.
Closes#31115
This fixes regression caused by
https://github.com/zed-industries/zed/pull/30824 while keeping that fix.
- [x] Test
Release Notes:
- Fixed the issue where adding a newline after the `///` comment would
extend it with `//` instead of `///` in Rust and other similar
languages.
Closes#5255, #1046, #28322, #15728
This PR makes `AddSelectionBelow` and `AddSelectionAbove` not skip lines
that are shorter than the current cursor column. This follows the same
behavior as VSCode and Sublime.
This change is only applicable in the case of an empty selection; if
there is a non-empty selection, it continues to skip empty and shorter
lines to create a Vim-like column selection, which is the better default
for that case.
- [x] Tests
The empty selection no longer skips shorter lines:
https://github.com/user-attachments/assets/4bde2357-20b6-44f2-a9d9-b595c12d3939
Non-empty selection continues to skip shorter lines.
https://github.com/user-attachments/assets/4cd47c9f-b698-40fc-ad50-f2bf64f5519b
Release Notes:
- Improved `AddSelectionBelow` and `AddSelectionAbove` to no longer skip
shorter lines when the selection is empty, aligning with VSCode and
Sublime behavior.
This PR hides hover info/diagnostic popovers when code action menu is
shown. We already hide hover info/diagnostic popover on code completion
menu trigger (handled on input).
Note: It is still possible to see hover popover if code completion or
code action menu is already open. This is intended behavior.
- [x] Test hover popover hides when code action is triggered
Release Notes:
- Fixed issue where info and diagnostic hover popovers were still
visible when code action menu is triggered.
This PR fixes a bug where comments don't extend when cursor is right
next to the second slash. We added `// ` as a prefix character to
correctly position the cursor after a new line, but this broke comment
validation by including that trailing space, which it shouldn't.
Now both line comments and block comments (already handled in JSDoc PR)
can extend right after the prefix without needing an additional space.
Before:
https://github.com/user-attachments/assets/ca4d4c1b-b9b9-4f1b-b47a-56ae35776f41
After:
https://github.com/user-attachments/assets/b3408e1e-3efe-4787-ba68-d33cd2ea8563
Release Notes:
- Fixed issue where comments weren't extending when adding new line
immediately after comment prefix (`//`).
Follow up for https://github.com/zed-industries/zed/pull/30768
This PR makes JSDoc auto comment on new line lot better by:
- Inserting delimiters regardless of whether previous delimiters have
trailing spaces or not
- When on start tag, auto-indenting both prefix and end tag upon new
line
This makes it correct as per convention out of the box. No need to
manually adjust spaces on every new line.
https://github.com/user-attachments/assets/81b8e05a-fe8a-4459-9e90-c8a3d70a51a2
Release Notes:
- Improved JSDoc auto-commenting on newline which now correctly indents
as per convention.
Closes#26274
Adjust the end position of indent guides to prevent them from extending
through empty space.
Also corrected old test values that seemed to have adapted to the
indentation's behavior.
Release Notes:
- Fixed indentation guides extending beyond the final scope in a file.
## 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>
Closes#28699
Fixes two cases in the `editor::SelectLargerSyntaxNode` action:
1. When cursor is at the end of a word, it now selects that word first
instead of selecting the whole line.
2. When cursor is at the end of a line, it now selects that line first
instead of selecting the whole code block.
Before and After:
https://github.com/user-attachments/assets/233b891e-15f1-4f10-a51f-75693323c2bd
Release Notes:
- Fixed `editor::SelectLargerSyntaxNode` to properly select nodes when
the cursor is positioned at the end of words or lines.
When starting a selection from only carets, the action
`editor::SelectPrevious` behaved in a manner inconsistent with
`editor::SelectNext` as well as equivalent keybinds in editors such as
VSCode, by selecting substrings of whole words matching the initially
selected string on subsequent triggers.
This fix brings the `select_previous` function in line with
`select_next_internal`by calling `select_match_ranges` (previously an
internal function of `select_next_internal`) in the same way it was
previously used in the function that exhibited expected behavior.
Furthermore, the relevant test was adapted to bring it in line with the
equivalent test for the `editor::SelectNext` action
Closes#24346
Release Notes:
- Fixed inconsistent SelectPrevious behavior
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>
Closes#29544
Fixes an issue where accepting an HTML completion would correctly edit
the start tag but incorrectly update the end tag due to incorrect linked
edit ranges.
I want to handle multi cursor case (as it barely works now), but seems
like this should go first. As, it might need whole `do_completions`
overhaul.
Todo:
- [x] Tests for completion aceept on linked edits
Before:
https://github.com/user-attachments/assets/917f8d2a-4a0f-46e8-a004-675fde55fe3d
After:
https://github.com/user-attachments/assets/84b760b6-a5b9-45c4-85d8-b5dccf97775f
Release Notes:
- Fixes an issue where accepting an HTML completion would correctly edit
the start tag but incorrectly update the end tag.