This is quite experimental and untested in languages other than Rust.
It's written to attempt to do something sensible in many languages. Due
to its experimental nature, just releasing to staff, and so not
including it in release notes. Future release note might be "Improved
diagnostic excerpts by using syntactic info to determine the context
lines to show."
Release Notes:
- N/A
Leaving release notes as N/A because it had release notes in the past in
#21705
In #21286, documentation resolution was made more efficient by only
resolving the current completion. However, this meant that single line
documentation shown inline in the menu was missing until scrolled
to. This also meant that it would wait for navigation to resolve
completion docs, leading to lag for displaying documentation.
This change resolves this by attempting to fetch all the completions
that will be shown. It also mostly avoids re-resolving completions. It
intentionally re-resolves the current selection on navigation, as some
language servers will respond with more information later on.
Release Notes:
- N/A
We've received a complaint on Discord about bad multicursor performance.
I too run 15k cursor simultaneously. The gist of the issue was in the
lsp_ext; whenever we gather up actions to be registered on a buffer, we
need to know whether a buffer has any of the languages for which we have
LSP extensions. The problem stemed from the fact that we did a two-phase
filtering. For each selection we'd first check whether this selection
lies in a part of a file that is part of a language for which we have
LSP extensions. Then, we'd check whether we're running a language server
of interest for this buffer.
This is not optimal, because it would often do the redundant work:
1. We resolve selections for buffer that are known to not contain a
given language server.
2. We look up language server in the LspStore once per each matching
selection.
In case where the file is not related at all, we end up resolving all of
the selections which is pretty bad. This PR makes us skip buffers which
are known to not match the criteria. It also caches the result of
language server lookup for the buffers.
Closes #ISSUE
Release Notes:
- Improved performance with large quantity of cursors
This PR ensures that, for fixed-width fonts, the cursor width is the
same on blank lines as on non-blank lines, as well as at the end of a
line. It does so by using the em advance to define the cursor width
instead of the em width in these cases.
Note that this can look... bizarre on non-fixed-width fonts:
<img width="93" alt="Screenshot 2024-12-19 at 21 43 11"
src="https://github.com/user-attachments/assets/a4c9b26c-98ea-4a1d-947b-51f1acd3c2f8"
/>
However, this is arguably reasonably consistent with how (terminal) Vim
handles it:
<img width="45" alt="Screenshot 2024-12-19 at 21 46 42"
src="https://github.com/user-attachments/assets/ec3ff614-7a15-4cc3-8d14-3d15ce62f2b8"
/>
Closes#22260.
Release Notes:
- N/A
Closes #ISSUE
Still TODO to make this feature good is better command history
Release Notes:
- vim: Add support for `:g/<pattern>/<cmd>` and `:v/<pattern>/<cmd>`
If an inline completion isn't shown in a menu, we highlight text in the
editor as deleted.
But if it's shown in the menu, we didn't even show deleted text, which
makes it hard to understand what's going on.
This fixes it.
![screenshot-2024-12-18-14 34
55@2x](https://github.com/user-attachments/assets/579639e4-5ed9-4fe6-8e21-65166d192432)
Release Notes:
- N/A
This changes #22093 by making the change only have an effect for the
supported provider: Zeta.
Made the change because the UX is still experimental and I don't want to
break existing workflows for Copilot/Supermaven users.
Even Zeta users can opt-out of it by setting
`"show_inline_completions_in_menu": false` in their settings, in case
they want the old show-inline-completion-or-show-lsp-completion behavior
back.
Release Notes:
- N/A
Possible panic here in case we can't find the excerpt in the
multibuffer.
I thought this could happen when the inline completion references an
excerpt that disappeared from the multibuffer, but looking at the code
I'm not sure anymore - we use the same multibuffer snapshot in this
whole function and the `anchor_in_excerpt` method clips the anchors.
Still, let's be safe here.
Release Notes:
- N/A
We were committing the cardinal sin of subtracting one from a column
without clipping
Closes #ISSUE
Release Notes:
- Fixed a panic in linked editing ranges
* Presence of the aside no longer affects position or size of the
context menu.
* Prefers to fit to the right, then on same side of line, then other
side of line, within the following preference order:
- Max possible size within text area.
- Max possible size within window.
- Actual size within window. This is the only case that could cause it
to jump around with less stability.
A further enhancement atop this might be to dynamically resize aside
height to fit.
Release notes are N/A as they are covered by the notes for #22102.
Closes#8523
Release Notes:
* N/A
![editor_scrollbars](https://github.com/user-attachments/assets/76c26776-8fe4-47f8-9c79-9add7d7d2151)
Closes#4427
Release Notes:
- Added a horizontal scrollbar to the editor panel
- Added `axis` option to `scrollbar` in the Zed configuration, which can
forcefully disable either the horizontal or vertical scrollbar
- Added `horizontal_scroll_margin` equivalent to
`vertical_scroll_margin` in the Zed configuration
Rough Edges:
This feature seems mostly stable from my testing. I've been using a
development build for about a week with no issues. Any feedback would be
appreciated. There are a few things to note as well:
1. Scrolling to the lower right occasionally causes scrollbar clipping
on my end, but it isn't consistent and it isn't major. Some more testing
would definitely be a good idea. [FIXED]
2. Documentation may need to be modified
3. I added an `AxisPair` type to the `editor` crate to manage values
that have a horizontal and vertical variant. I'm not sure if that's the
optimal way to do it, but I didn't see a good alternative. The `Point`
type would technically work, but it may cause confusion.
---------
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This makes inline completions show up in the completion menu even if the
user has set `"show_completion_documentation": false` in their settings,
because there is no other way to show the Zeta completion.
Follow-up to #22093
Release Notes:
- N/A
Co-authored-by: Danilo <danilo@zed.dev>
* Now decides whether the menu is above or below the target position
before rendering it. This causes its position to no longer vary
depending on the length of completions
* When the text area is height constrained (< 12) lines, now chooses the
side which has the most space. Before it would always display above if
height constrained below.
* Misc code cleanups
Release Notes:
- Improved completions menu layout to be more stable and use available
space better.
- Ensuring that the fold button is big enough to avoid clicking on the
header as a whole (and then moving to the actual file)
- Adding tooltips to the fold button
- Refining the container structure so that the tooltip for the folder
button and the header click don't overlap
- Adding keybindings to tooltips
https://github.com/user-attachments/assets/82284b59-3025-4d6d-b916-ad4d1ecdb119
Release Notes:
- N/A
Follow-up of https://github.com/zed-industries/zed/pull/22004
* Reuse center terminals for tasks, when requested
* Extend task templates with `RevealTarget`, moving it from
`TaskSpawnTarget` into the core library
* Use `reveal_target` instead of `target` to avoid misinterpretations in
the task template context
* Do not expose `SpawnInTerminal` to user interface, avoid it
implementing `Serialize` and `Deserialize`
* Remove `NewCenterTask` action, extending `task::Spawn` interface
instead
* Do not require any extra unrelated parameters during task resolution,
instead, use task overrides on the resolved tasks on the modal side
* Add keybindings for opening the task modal in the
`RevealTarget::Center` mode
Release Notes:
- N/A
This is related to #22069 and #21858: before both of these PRs, we would
only ever show inline completions OR completions, never both at the same
time.
Now we show both at the same, but we still had this piece of logic here,
that prevented non-inline completions from showing up if there was
already an inline completion.
With this change, it's possible to get LSP completions without having to
dismiss inline completions before.
Release Notes:
- Inline completions (Copilot, Supermaven, ...) don't stop other
completions from showing up anymore. Both can now be visible at the same
time.
---------
Co-authored-by: Bennet <bennet@zed.dev>
I'm not sure about this yet.
On one hand: it's nice that the completion doesn't just disappear when I
hit escape because I was typing and in the flow.
On the other hand: no other inline completion provider keeps the
suggestion when leaving insert mode.
I'm going to merge this so we can get it into nightly and try it out for
the next couple of days. cc @ConradIrwin
Release Notes:
- vim: Do not dismiss inline completions when leaving insert/replace
mode with `<esc>`.
`CodeContextMenu` is always accessed on one thread, so only `Rc`s and
`Rc<RefCell<_>>` are needed. There should be tiny performance benefits
from this. The main benefit of this is that when seeing code accessing a
`RwLock` it would be reasonable to wonder whether it will block. The
only potential downside is the potential for panics due to overlapping
borrows of the RefCells. I think this is an acceptable risk because most
errors of this nature will be local or will be caught by clippy via the
check for holding a RefCell reference over an `await`.
Release Notes:
- N/A
This fixes#21837, where CompletionsMenu fuzzy match positions were
desynchronized from completion label text. The solution is to not mutate
`match_candidates` and instead offset the highlight positions in the
rendering code.
This solution requires that the fuzzy match text not change on
completion resolution. This is a property we want anyway, since fuzzy
match text changing means items unexpectedly changing position in the
menu.
What happened:
* #21521 updated completion resolution to modify labels on resolution.
- This interacted poorly with the code
[here](341e65e122/crates/editor/src/code_context_menus.rs (L604)),
where the fuzzy match results are updated to include the full label, and
the fuzzy match result positions are offset to be in the correct place.
The fuzzy mach positions were now invalid because they were based on the
old text.
* #21705 caused completion resolution to occur more frequently. Before
this only the selected item was being resolved. This caused the panic
due to invalid positions to happen much more frequently.
Closes#21837
Release Notes:
- N/A
Closes https://github.com/zed-industries/zed/issues/4925https://github.com/user-attachments/assets/e7b87375-893f-41ae-a2d9-d501499e40d1
Allows to fold any buffer inside multi buffers, either by clicking the
chevron icon on the header, or by using
`editor::Fold`/`editor::UnfoldLines`/`editor::ToggleFold`/`editor::FoldAll`
and `editor::UnfoldAll` actions inside the multi buffer (those were noop
there before).
Every fold has a fake line inside it, so it's possible to navigate into
that via the keyboard and unfold it with the corresponding editor
action.
The state is synchronized with the outline panel state: any fold inside
multi buffer folds the corresponding file entry; any file entry fold
inside the outline panel folds the corresponding buffer inside the multi
buffer, any directory fold inside the outline panel folds the
corresponding buffers inside the multi buffer for each nested file entry
in the panel.
Release Notes:
- Added a possibility to fold buffers inside multi buffers
---------
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
Co-authored-by: Max Brunsfeld <max@zed.dev>
Co-authored-by: Cole Miller <cole@zed.dev>
This PR adds a new `hover_popover_delay` setting that allows the user to
specify how long to wait before showing informational hover boxes. It
defaults to the existing delay.
Release Notes:
- Added a setting to control the delay for informational hover boxes
Closes#20060Closes#20720Closes#19873Closes#9445
Release Notes:
- Fixed a bug where tasks would be spawned with their working directory
set to a file in some cases
- Added the ability to spawn tasks in the center pane, when spawning
from a keybinding:
```json5
[
{
// Assuming you have a task labeled "echo hello"
"ctrl--": [
"task::Spawn",
{ "task_name": "echo hello", "target": "center" }
]
}
]
```
Improves the new `Editor::DuplicateSelection` @CharlesChen0823 added in
https://github.com/zed-industries/zed/pull/21154.
- Merge `duplicate_selection` and `duplicate_line` into single function.
- Add keyboard shortcuts to JetBrains and SublimeText keymaps.
- If the selection is empty (e.g. just a cursor) make
`Editor::DuplicateSelection` fallback to being the same as
`Editor::DuplicateLineDown`.
- Tested with multiple cursors and for multiple selections.
| Editor | Action | macOS | Linux |
| ----------- | ------------------- | ----------- | ------------ |
| VSCode | Duplicate Selection | | |
| JetBrains | Duplicate Selection | cmd-d | ctrl-d |
| XCode | Duplicate | cmd-d | N/A |
| SublimeText | duplicate_line | cmd-shift-d | ctrl-shift-d |
This matches behavior of the `duplicate` functionality in all other
major editors, with one exception: other editors change the selection so
that the newly duplicated object, current Zed behavior leaves the
original selection unchanged (TODO?)
![CleanShot 2024-12-13 at 11 27
39@2x](https://github.com/user-attachments/assets/7c7828c0-c5c7-4dc6-931e-722366d4f15a)
- Adds the Switch component
- Updates `Selected`, `Selectable` -> `ToggleState`, `Toggleable`
- Adds `checkbox` and `switch` functions to align better with other
elements in our layout system.
We decided not to merge Switch and Checkbox. However, in a followup I'll
introduce a Toggle or AnyToggle enum so we can update
`CheckboxWithLabel` -> `ToggleWithLabel` as this component will work
exactly the same with either a Checkbox or a Switch.
Release Notes:
- N/A
Noticed that whitespace-only insertions are really hard to make out, so
this changes it to make them visible by giving them a green background.
![screenshot-2024-12-13-10 49
09@2x](https://github.com/user-attachments/assets/10d83067-46f2-4cb5-97fa-0f44d254890d)
Release Notes:
- N/A
---------
Co-authored-by: Antonio <antonio@zed.dev>
Closes#21718
Just like in Vim, if a URL is selected, it opens exactly that portion of
the URL. Otherwise, if only the cursor is on a URL, it opens the entire
URL.
Zed currently does the latter. This PR also adds support for the former.
https://github.com/user-attachments/assets/8bdd2952-ceec-487c-b27a-5cea4258eb03
Release Notes:
- Updated the `editor: open url` to also handle the selected portion of
a URL.
This change allows defining keybindings that are active when there is a
text selection.
This is especially useful, as an example, for Emacs-like keybindings
where movement keybindings expand the selection.
Here is a snippet from my keymap.json that implements Emacs movements
when selection is active:
```json
{
"context": "Editor && selection",
"bindings": {
"ctrl-f": "editor::SelectRight",
"ctrl-b": "editor::SelectLeft",
"ctrl-n": "editor::SelectDown",
"ctrl-p": "editor::SelectUp",
"ctrl-a": "editor::SelectToBeginningOfLine",
"ctrl-e": "editor::SelectToEndOfLine",
"alt-f": "editor::SelectToNextWordEnd",
"alt-b": "editor::SelectToPreviousWordStart",
"alt-<": "editor::SelectToBeginning",
"alt->": "editor::SelectToEnd"
}
}
```
What do you think about inclusion of this feature? Should I add more granular `selection=single` `selection=multi`?
Release Notes:
- Added "selection" context for keybindings that are active when there is a text selection.
Closes https://github.com/zed-industries/zed/issues/6843
I don't see where is the logic to remove old document highlight when new
one applies,
ideally, old highlight should be cleared as soon as possible when cursor
moves if the new position does not
sits in old highlight ranges to avoid linger highlights described in
https://github.com/zed-industries/zed/issues/13682#issuecomment-2498368680.
So current solution is still not ideal, because only when lsp responses
highlight ranges (even is a empty set) can we clear the old one.
Release Notes:
- Added a setting `lsp_highlight_debounce` to configure delay for
querying highlights from language server.
---------
Co-authored-by: mgsloan@gmail.com <michael@zed.dev>