Cherry-picked editor: Hide horizontal scrollbar if not visible (#23337)
This PR fixes two visual issues, that were caused by the fact that we
were always painting the horizontal scrollbar even if there is no
horizontal scrolling possible
Obscuring deleted lines when using the inline assistant:
https://github.com/user-attachments/assets/f8460c3f-403e-40a6-8622-65268ba2d875
Cutting off text even when horizontal scrolling is not possible:
https://github.com/user-attachments/assets/23c909f7-1c23-4693-8edc-40a2f089d4a8
This issue was only present in some themes (e.g. Nord, Catpuccin)
Closes#22716
Release Notes:
- Fixed an issue where horizontal scrollbars of editors would always be
painted (even if there is no horizontal scrolling to be done)
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Cherry-picked Fix accepting partial inline completion (#23312)
Release Notes:
- Fixed a bug that could prevent accepting a partial inline completion.
Co-authored-by: Antonio Scandurra <me@as-cii.com>
These checks were not functioning as intended. Notably tests were
skipped for today's hotfix release of Preview
[v0.169.2-pre](https://github.com/zed-industries/zed/actions/runs/12790602047):
Separately these checks were flawed as they would only be considered
"docs only" if the diff between the PR branch base and main also did not
have any subsequent non-docs changes.
Reverting until we can figure out something better.
Add `phi4` maximum context length (128K).
By default this clamps to `16384` but if you have enough video memory
you can set it higher or connect to a non-local machine via settings:
```json
"language_models": {
"ollama": {
"api_url": "http://localhost:11434",
"available_models": [
{
"name": "phi4",
"display_name": "Phi4 64K",
"max_tokens": 65536
}
]
}
}
```
Release Notes:
- Improve support for Phi4 with ollama.
Cherry-picked Revert "linux: Fix saving file with root ownership
(#22045)" (#23162)
Release Notes:
- (temporarily) Removes the linux "save file as root" feature while we
figure out bugs.
Updates https://github.com/zed-industries/zed/pull/22045
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This PR also removes the `ThumbsUp` action that wasn't being triggered
correctly. We didn't have it's counterpart `ThumbsDown`, too, so I
mostly assumed it would be harmless to remove `ThumbsUp` as well.
<img width="800" alt="Screenshot 2025-01-10 at 6 18 44 PM"
src="https://github.com/user-attachments/assets/9fd5da9f-9dff-454d-9f31-c02f1370b937"
/>
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
# Conflicts:
# crates/zeta/src/rate_completion_modal.rs
Two issues i ran into while looking at the completion rating modal
- Single-file worktrees file names are not displayed at all
- Hard to see the filename when the path is long (lots of directories)
This PR fixes this by displaying the filename on the left, followed by
the full path (including the worktree name), similar to how we do it in
the file finder/assistant panel /file command
| Before | After |
|--------|--------|
| <img width="1067" alt="Screenshot 2025-01-14 at 16 09 05"
src="https://github.com/user-attachments/assets/628fde18-da9a-4d98-8ddf-ed0ab0cd8d35"
/> | <img width="1161" alt="Screenshot 2025-01-14 at 16 17 52"
src="https://github.com/user-attachments/assets/80c6a4e1-065d-4b0a-b9c0-5f3391af4557"
/> |
Release Notes:
- N/A
# Conflicts:
# crates/zeta/src/rate_completion_modal.rs
Various fixes for Zeta and one fix that's visible to non-Zeta-using
users of inline completions.
Release Notes:
- Changed inline completions (Copilot, Supermaven, ...) to not show up
in empty buffers.
---------
Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Bennet <bennet@zed.dev>
# Conflicts:
# crates/zeta/src/rate_completion_modal.rs
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>