This changes the behaviour of `<tab>` when inline completion is visible.
When the cursor is before the suggested indentation level, accepting a
completion should just indent.
cc @nathansobo @maxdeviant
Release Notes:
- Changed the behavior of `<tab>` at start of line when an inline
completion (Copilot, Supermaven, ...) is visible. If the cursor is
before the suggested indentation, `<tab>` now indents the line instead
of accepting the visible completion.
Co-authored-by: Antonio <antonio@zed.dev>
Cherry-picked Improve registration for Assistant code action providers
(#23099)
This PR is a follow-up to
https://github.com/zed-industries/zed/pull/22911 to further improve the
registration of code action providers for the Assistant in order to
prevent duplicates.
The `CodeActionProvider` trait now has an `id` method that is used to
return a unique ID for a code action provider. We use this to prevent
registering duplicates of the same provider.
The registration of the code action providers for Assistant1 and
Assistant2 have also been reworked. Previously we were not call the
registration function—and thus setting up the subscriptions—until we
resolved the feature flags. However, this could lead to the registration
happening too late for existing workspace items.
We now perform the registration right away and then remove the undesired
code action providers once the feature flags have been resolved.
Release Notes:
- N/A
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Cherry-picked Fix duplicated `Fix with Assistant` code actions (#22911)
This PR fixes the duplicated `Fix with Assistant` code actions that were
being shown in the code actions menu.
This fix isn't 100% ideal, as there is an edge case in buffers that are
already open when the workspace loads, as we may not observe the feature
flags in time to register the code action providers by the time we
receive the event that an item was added to the workspace.
Closes https://github.com/zed-industries/zed/issues/22400.
Release Notes:
- Fixed duplicate "Fix with Assistant" entries showing in the code
action list.
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Cherry-picked editor: Adjust offset of the opened jump target in the
multibuffer (#23091)
This PR fixes an issue with jumping from multi_buffer to a file; namely,
the scroll offset of the opened buffer used to match the position within
the multibuffer, but it broke a while back. This is because we were
opening a buffer without providing the data about the origin scroll
offset.
Closes #ISSUE
Release Notes:
- Fixed a bug where the relative position of an excerpt within the
multibuffer was not accounted for while jumping to the buffer, causing
the clicked line to drastically change position on screen.
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Cherry-picked terminal: Fix unresponsive buttons on load until center
pane is clicked + Auto-focus docked terminal on load if no other item is
focused (#23039)
Closes#23006
This PR should have been split into two, but since the changes are
related, I merged them into one.
1. On load, the title bar actions and bottom bar toggles are
unresponsive until the center pane is clicked. This happens because the
terminal captures focus (even if it's closed) long after the workspace
sets focus to itself during loading.
The issue was in the `focus_view` call used in the `new` method of
`TerminalPanel`. Since new terminal views can be created behind the
scenes (i.e., without the terminal being visible to the user), we
shouldn't handle focus for the terminal in this case. Removing
`focus_view` from the `new` method has no impact on the existing
terminal focusing logic. I've tested scenarios such as creating new
terminals, splitting terminals, zooming, etc., and everything works as
expected.
2. Currently, on load, docked terminals do not automatically focus when
they are only visible item to the user. This PR implements it.
Before/After:
1. When only the dock terminal is visible on load. Terminal is focused.
<img
src="https://github.com/user-attachments/assets/af8848aa-ccb5-4a3b-b2c6-486e8d588f09"
alt="image" height="280px" />
<img
src="https://github.com/user-attachments/assets/8f76ca2e-de29-4cc0-979b-749b50a00bbd"
alt="image" height="280px" />
2. When other items are visible along with the dock terminal on load.
Editor is focused.
<img
src="https://github.com/user-attachments/assets/d3248272-a75d-4763-9e99-defb8a369b68"
alt="image" height="280px" />
<img
src="https://github.com/user-attachments/assets/fba5184e-1ab2-406c-9669-b141aaf1c32f"
alt="image" height="280px" />
3. Multiple tabs along with split panes. Last terminal is focused.
<img
src="https://github.com/user-attachments/assets/7a10c3cf-8bb3-4b88-aacc-732b678bee19"
alt="image" height="270px" />
<img
src="https://github.com/user-attachments/assets/4d16e98f-9d7a-45f6-8701-d6652e411d3b"
alt="image" height="270px" />
Future:
When a docked terminal is in a zoomed state and Zed is loaded, we should
prioritize focusing on the terminal over the active item (e.g., an
editor) behind it. This hasn't been implemented in this PR because the
zoomed state during the load function is stale. The correct state is
received later via the workspace. I'm still investigating where exactly
this should be handled, so this will be a separate PR.
cc: @SomeoneToIgnore
Release Notes:
- Fixed unresponsive buttons on load until the center pane is clicked.
- Added auto-focus for the docked terminal on load when no other item is
focused.
Co-authored-by: tims <0xtimsb@gmail.com>
Cherry-picked Do not try to activate the terminal panel twice (#23029)
Closes https://github.com/zed-industries/zed/issues/23023
Fixes terminal pane button opening two terminals on click.
The culprit is in
61115bd047/crates/workspace/src/workspace.rs (L2412-L2417)
* We cannot get any panel by index from the Dock, only an active one
* Both `dock.activate_panel(panel_index, cx);` and `dock.set_open(true,
cx);` do `active_panel.panel.set_active(true, cx);`
So, follow other pane's impls that have `active: bool` property for this
case, e.g.
3ec52d8451/crates/assistant/src/inline_assistant.rs (L2687)
Release Notes:
- Fixed terminal pane button opening two terminals on click
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Fixes an incorrect error message.
Turns out it is impossible to set remote tracking to a branch that doesn't exist on the remote, so let's not even try.
Reverts #22834
Reverts #22614
Previously, to use a green and red shade with `TintColor` you'd need to
pass `Positive` and `Negative`, respectively. This terminology always
tripped me up, because, for example, I'd often try to use something
like:
```
Button::new("icon_color", "Negative")
style(ButtonStyle::Tinted(TintColor::Negative))
.color(Color::Error)
.icon_color(Color::Error)
.icon(IconName::Trash),
)
```
...and due to `icon_color` taking `Color::Error`, I'd always get
`TintColor` wrong at a first try, because I would, out of muscle memory,
write `TintColor::Error`, which wouldn't compile. That's exactly the
change in this PR—`TintColor` now takes `Success` and `Error` instead of
`Positive` and `Negative`, for more consistency.
Release Notes:
- N/A
We'll now show an error message if the user tries to add a directory
that contains no text files or when they try to add a single non-text
file.
Release Notes:
- N/A
---------
Co-authored-by: Danilo <danilo@zed.dev>
Closes#22798
This fixes that we didn't detect the Rust runnable when there was a
comment after the `#[test]` attribute.
![Screenshot 2025-01-08 at 13 22
59](https://github.com/user-attachments/assets/bd6a7ae0-93d4-4f93-9d0d-11453acb2032)
Release Notes:
- Fixed Rust runnable not detected when comment is after `#[test]`
attribute.
---------
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Goal: Allow zed to locate [`pixi`](https://github.com/prefix-dev/pixi)
environments
Changes:
- Uses a newer release of
[`python-environment-tools`](https://github.com/microsoft/python-environment-tools)
with the new `pet-pixi` create
- Adds `PythonEnvironmentKind::Pixi` as a possible environment kind, to
allow the rest of the code to detect the environment
I tested the changes locally. It found the correct pixi environment and
I was able to run `pytest` through the UI icon.
Release Notes:
- Added detection for pixi-environments
---------
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This fixes the issue described in this comment:
https://github.com/zed-industries/zed/pull/22439#issuecomment-2563896422
Essentially, we'd clip in the wrong direction when there were multi-line
inlay hints.
It also fixes inline completions for non-Zeta-providers showing up in
normal mode.
Release Notes:
- N/A
Co-Authored-By: Thorsten <thorsten@zed.dev>
Release Notes:
- Fix selected suggestion updating too many times when Zeta triggers
Co-authored-by: Thorsten <thorsten@zed.dev>
### Edit 1:
I tested it locally and it works!
### IMPORTANT:
**Feedback and suggestions for improvement are greatly appreciated!**
This commit introduces a new AnyQuotes text object to handle text
surrounded by single quotes ('), double quotes ("), or back quotes (`)
seamlessly. The following changes are included:
- Added AnyQuotes to the Object enum to represent the new feature.
- Registered AnyQuotes as an action in the actions! macro and register
function to ensure proper integration with Vim actions like ci, ca, di,
and da.
- Extended Object::range to check for surrounding single, double, or
back quotes sequentially.
- Updated methods like is_multiline and always_expands_both_ways to
ensure consistent behavior with other text objects.
- Added support in surrounding_markers to evaluate any of the quote
types when AnyQuotes is invoked.
- This enhancement provides users with a flexible and unified way to
interact with text objects enclosed by different types of quotes.
Release Notes:
- vim: Add `aq`/`iq` "any quote" text objects that are the smallest of
`a"`, `a'` or <code>a`</code>
fixed a bug where with the "show_whitespaces": "boundary" option, when
there was an "à" followed by a space, a white space was displayed, and
when "à" was at the end of the line, a white space was added
Release Notes:
- N/A
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Closes https://github.com/zed-industries/zed/issues/21613
Same as `bundle-linux`, to avoid panicking on missing licenses for
homegrown-built releases when `Help -> View dependency licenses` menu
action is triggered.
Release Notes:
- Altered bundle-mac script to generate licenses
This pr closes#21466 issue by disabling math in pulldown_cmark Parser.
The dollar sign symbol is used in pulldown_cmark Math extension, see
"Math in links" section for more details:
https://pulldown-cmark.github.io/pulldown-cmark/specs/math.html
I've tried another approach at first, without disabling math extension:
```
let iterator = TextMergeWithOffset::new(Parser::new_ext(text, options));
```
instead of current implementation
```
Parser::new_ext(text, options).into_offset_iter()
```
This way pulldown_cmark merges consecutive text events and this helps to
correctly parse links from plain text:
https://svelte.dev/docs/svelte/$state
But in this case the dollar sign still breaks markdown links:
\[https://svelte.dev/docs/svelte/$state](https://svelte.dev/docs/svelte/$state)
So in the end I disabled the math extension, it fixes both link formats.
See markdown/examples/markdown.rs to reproduce.
Release Notes:
- N/A
Ensuring all of the assistant 2 actions have keybindings.
Release Notes:
- N/A
---------
Co-authored-by: Agus Zubiaga <hi@aguz.me>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
I'm consistently getting the following error on startup:
```
2025-01-05T14:45:43.4602865+01:00 [ERROR] SHELL environment variable is not assigned so we can't source login environment variables
Caused by:
environment variable not found
```
The source function, `load_login_shell_environment`, assumes a UNIX
environment and should therefore not be called on Windows. (Unless you
are using git bash?)
Release Notes:
* N/A
This PR adds some intermediate bindings to the checks for if a
file/directory is already included to make the conditional a bit
clearer.
It wasn't immediately obvious what the boolean values corresponded to
when looking at it.
Release Notes:
- N/A
This PR makes it so the context is persistent in the thread, rather than
having to reattach it for each message.
This PR intentionally does not make an attempt to refresh the attached
context if it changes. That will come in a follow-up.
Release Notes:
- N/A
The most relevant change in this PR is ensuring that the path tooltip
doesn't overlap with the "Remove Context" tooltip. Now, the former
tooltip only shows if you hover over the context pill's label. This
avoids a little flicker that was happening as the path tooltip would
show first and then quickly followed by the icon button's one.
Release Notes:
- N/A
Closes#22659
More context can be found in attached issue.
This is specific to Windows:
1. Add parent directory watching for fs watch when the file doesn't
exist. For example, when Zed is first launched and `settings.json` isn't
there.
2. Add proper symlink handling for fs watch. For example, when
`settings.json` is a symlink.
This is exactly same as how we handle it on Linux.
Release Notes:
- Fixed an issue where items on the Welcome page could not be toggled on
Windows, either on first launch or when `settings.json` is a symlink.
Closes#9656. Continuation of #9654, but with the addition of backwards
compatibility for the existing captures.
Release Notes:
- Improved Tree-sitter support with added compatibility for standard
injections captures
---------
Co-authored-by: Finn Evers <finn.evers@outlook.de>
This is a follow-up to #22615 and fixes the issue of `alacritty`
resulting in broken shell/CLI apps if `alacritty` is not in the terminfo
database.
Closes #ISSUE
Release Notes:
- Set `TERM` to `xterm-256color` in Zed's built-in terminal
This makes the `RemoveFromProject` action to remove all marked entries
in the project panel instead of just the selected one.
Closes#22454
Release Notes:
- Improved the `RemoveFromProject` action to remove all selected items.
This PR is a small refactoring in advance of some other changes.
Previously we were storing the whole `Context` associated with each
message. However, it's likely that multiple messages may end up using
the same context.
We now store the deduped context in a separate collection and refer to
it from each message by its `ContextId`.
Release Notes:
- N/A