This PR removes the `SwitchWithLabel` component because we're adding
`label` as a method to `Switch`. Thus, we no longer need an extra
component just to append a label. Additionally, we're also adding
`keybinding` as a method.
Release Notes:
- N/A
---------
Co-authored-by: Agus Zubiaga <hi@aguz.me>
Falls back on notifying all workspaces if there isn't an active one.
This is to support notifying the user about keymap file errors in
#23113. It will also be useful for notifying about settings file errors.
Release Notes:
- N/A
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.
Also:
* Adds `impl_internal_actions!` for deriving the `Action` trait without
registering.
* Removes some deserializers that immediately fail in favor of
`#[serde(skip)]` on fields where they were used. This also omits them
from the schema.
Release Notes:
- Keymap settings file now has more JSON schema information to inform
`json-language-server` completions and info, particularly for actions
that take input.
The context picker will now display up to 6 recent files/threads to add
as a context:
<img
src="https://github.com/user-attachments/assets/80c87bf9-70ad-4e81-ba24-7a624378b991"
width=400>
Note: We decided to use a `ContextMenu` instead of `Picker` for the
initial one since the latter didn't quite fit the design for the
"Recent" section.
Release Notes:
- N/A
---------
Co-authored-by: Danilo <danilo@zed.dev>
Co-authored-by: Piotr <piotr@zed.dev>
Co-authored-by: Nathan <nathan@zed.dev>
This PR adds an error toast that will be displayed when installing a dev
extension fails.
Here's what it looks like:
<img width="1310" alt="Screenshot 2025-01-09 at 11 56 42 AM"
src="https://github.com/user-attachments/assets/b65eb9f9-c559-4b99-b64a-ee301fa9e443"
/>
<img width="1310" alt="Screenshot 2025-01-09 at 12 10 30 PM"
src="https://github.com/user-attachments/assets/f4880221-2ed9-4bb0-9d48-1cb29c2b483f"
/>
I did have to touch the workspace `ErrorMessagePrompt` component to make
it scroll for long messages. I don't anticipate this being a problem for
other classes of errors (if anything, I suspect other long errors will
become more usable now).
Closes#21237.
Release Notes:
- Added an error toast that is shown when a dev extension fails to
install.
This PR is an alternate version of
https://github.com/zed-industries/zed/pull/22850, but now using a
similar approach to the existing `tab_content` and `tab_content_text`,
where `tab_tooltip_content` refers to the existing `tab_tooltip_text` if
there's no custom tooltip content/trait defined, meaning it will
simplify render the text/string content in this case.
This is all motivated by
https://github.com/zed-industries/zed/pull/21955, as we want to pull off
the ability to add custom content to a terminal tab tooltip.
Release Notes:
- N/A
This one seems to be triggered when the assistant's
`View<ContextEditor>` is leased during the call into
`NavHistory::for_each_entry`, which then tries to read it again through
the `ItemHandle` interface. Fix it by skipping entries that can't be
read in the history iteration.
Release Notes:
- N/A
Part of https://github.com/zed-industries/zed/issues/16472
Reduces amount of workspace serialization happening by:
* fixing the deserialization logic: now it does not set panels that are
hidden to active
* cleaning up `active_panel_index` for docks that are closed, to avoid
emitting extra events for such closed docks
* adjusting outline panel to drop active editor subscriptions on
deactivation — this way, `cx.observe` on the dock with outline panel is
not triggered (used to be triggered on every selection change before)
* adjusting workspace dock drag listener to remember previous
coordinates and only resize the dock if those had changed
* adjusting workspace pane event listener to ignore
`pane::Event::UserSavedItem` and `pane::Event::ChangeItemTitle` that
seem to happen relatively frequently but not influence values that are
serialized for the workspace
* not using `cx.observe` on docks, instead explicitly serializing on
panel zoom and size changes
Release Notes:
- Reduced amount of workspace serialization happening
- [x] Rewrite worktree git handling
- [x] Fix tests
- [x] Fix `test_propagate_statuses_for_repos_under_project`
- [x] Replace `WorkDirectoryEntry` with `WorkDirectory` in
`RepositoryEntry`
- [x] Add a worktree event for capturing git status changes
- [x] Confirm that the local repositories are correctly updating the new
WorkDirectory field
- [x] Implement the git statuses query as a join when pulling entries
out of worktree
- [x] Use this new join to implement the project panel and outline
panel.
- [x] Synchronize git statuses over the wire for collab and remote dev
(use the existing `worktree_repository_statuses` table, adjust as
needed)
- [x] Only send changed statuses to collab
Release Notes:
- N/A
---------
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.com>
Co-authored-by: Nathan <nathan@zed.dev>
This means that `workspace::ToggleRightDock` will open the assistant if
no right-dock panel has been manually activated, instead of the chat as
before. Also cleans up the `active_panel_index` logic a bit.
cc @nathansobo
Release Notes:
- Make `workspace::ToggleRightDock` open the assistant panel if no
right-dock panel has yet been activated
* Remove unnecessary WindowContext and ViewContext '_ lifetimes
* Removed some cases where WindowContext has a different name than `cx`.
Release Notes:
- N/A
Closes#17870
Context:
On Linux, when creating a new window, bounds are either pulled from
existing workspace data (serialized in an SQLite DB) or fall back to
some default constants if no data exists.
These bounds include the full dimensions of the window (width and
height), which already account for insets. However, properties like
`inset` (Wayland) or `last_insets` (X11) exist only at the platform
level and are not part of the window bounds themselves.
During rendering, we call `set_client_inset`, which updates the inset
values and also adjusts the window bounds, increasing their dimensions.
In Zed's case, the inset is 10px, which adds 20px to both the width and
height (10px from each side).
Problem:
When quitting, the full window bounds (which already account for inset)
are saved to the DB. On reopening, these saved bounds are used to create
the window. `set_client_inset` runs again and inflates the dimensions
even more.
Solution:
Store window bounds *without* the inset-inflated dimensions. On the next
session, `set_client_inset` will take care of applying the inset,
resulting window dimensions matching the previous session. This fix is
in the PR.
Alternative Solution:
Another option is to save the inset explicitly in the DB and apply it
during window creation. But this means storing more data, and the inset
would need to be platform-agnostic, which adds complexity. Doesn’t seem
worth it for no real gain.
X11 Before:
```sh
saving window bounds with width: 1136, height: 784
tims@lemon ~/w/zed (fix-window-growing-larger)> cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.37s
Running `target/debug/zed`
saving window bounds with width: 1156, height: 804 <---- +20px
tims@lemon ~/w/zed (fix-window-growing-larger)> cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s
Running `target/debug/zed`
saving window bounds with width: 1176, height: 824 <---- +20px
tims@lemon ~/w/zed (fix-window-growing-larger)> cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.36s
Running `target/debug/zed`
saving window bounds with width: 1196, height: 844 <---- +20px
```
X11 After:
```sh
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s
Running `target/debug/zed`
saving window bounds with width: 1116, height: 764
tims@lemon ~/w/zed (fix-window-growing-larger)> cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s
Running `target/debug/zed`
saving window bounds with width: 1116, height: 764 <---- same
tims@lemon ~/w/zed (fix-window-growing-larger)> cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s
Running `target/debug/zed`
saving window bounds with width: 1116, height: 764 <---- same
```
On Wayland, saving occurs only when you actually resize the window (on
X11, saving happens both on init and while dragging the window). To
trigger saving, I manually resized the window by ~1px to make it print.
Wayland Before:
```sh
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 36s
Running `target/debug/zed`
saving window bounds with width: 945, height: 577
tims@orange ~/zed (fix-window-growing-larger)> cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.77s
Running `target/debug/zed`
saving window bounds with width: 966, height: 597 <--- +20px on both (1px increase in width is me resizing)
tims@orange ~/zed (fix-window-growing-larger)> cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.87s
Running `target/debug/zed`
saving window bounds with width: 987, height: 618 <--- +20px on both (1px increase in width and height is me resizing)
tims@orange ~/zed (fix-window-growing-larger)> cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.89s
Running `target/debug/zed`
saving window bounds with width: 1006, height: 638 <--- +20px on both (1px decrease in width is me resizing)
```
Wayland After:
```sh
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.82s
Running `target/debug/zed`
saving window bounds with width: 925, height: 558
tims@orange ~/zed (fix-window-growing-larger)> cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.84s
Running `target/debug/zed`
saving window bounds with width: 925, height: 557 <--- same (1px decrease in height is me resizing)
saving window bounds with width: 925, height: 558
```
Release Notes:
- Fix non-maximized zed windows growing larger across sessions on Linux
---------
Co-authored-by: mgsloan@gmail.com <michael@zed.dev>
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
* Fixes the inability to drag and drop terminal tabs to reorder them;
fixed incorrect terminal tab move on drag and drop into existing pane
(follow-up of https://github.com/zed-industries/zed/pull/21238)
* Fixes save dialogue appearing when on closing terminal tabs with
running tasks (follow-up of
https://github.com/zed-industries/zed/pull/21374)
Release Notes:
- Fixed terminal pane tabs arrangement and closing
Add a `max_tabs` option to the settings that ensure no more than this
amount of tabs are open in a pane. If set to `null`, there is no limit.
Closes#4784
Release Notes:
- Added a `max_tabs` option to cap the maximum number of open tabs.
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" }
]
}
]
```
![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
Adds a simple git placeholder panel for us to iterate from. Also
includes a number of assets from the git prototyping branch that we will
use.
Note: This panel is staff flagged for now.
Release Notes:
- N/A
This PR updates the `gpui::prelude` to not export the `Context` trait
named.
This prevents some naming clashes in downstream consumers.
Release Notes:
- N/A
Follow up to https://github.com/zed-industries/zed/pull/21637
After discussing about this feature with the team, we've decided that
diagnostic display in tabs should be: 1) turned off by default, and 2)
only shown when there are file icons. The main reason here being to keep
Zed's UI uncluttered.
This means that you can technically have this setting:
```
"tabs": {
"show_diagnostics": "all"
},
```
...and still don't see any diagnostics because you're missing
`file_icons": true`.
| Error with file icons | Error with no file icons |
|--------|--------|
| <img width="800" alt="Screenshot 2024-12-06 at 21 05 13"
src="https://github.com/user-attachments/assets/babf9cc3-b3b0-492e-9748-3e97d96ce90e">
| <img width="800" alt="Screenshot 2024-12-06 at 21 05 24"
src="https://github.com/user-attachments/assets/5247a5f1-55a0-4c56-8aaf-a0cdd115464f">
|
Release Notes:
- N/A
Closes https://github.com/zed-industries/zed/issues/21652
* prevents zooming out the panel when any terminal pane is closed
* forces focus on new terminal panes, to prevent the workspace from
getting odd pane events in the background
Release Notes:
- (Preview only) Fixed zoomed terminal pane issues on split
Supersedes https://github.com/zed-industries/zed/pull/21653
This enables us to use `cargo test -p workspace` on macOS and Linux.
Note that the line diffs in `shared_screen.rs` are spurious, I just
re-ordered the `macos` and `cross-platform` modules to match the order
in the call crate.
Release Notes:
- N/A
Similar to #20826 but keeps the Swift implementation. There were quite a
few changes in the `call` crate, and so that code now has two variants.
Closes#13714
Release Notes:
- Added preliminary Linux support for voice chat and viewing
screenshares.
---------
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
Part of https://github.com/zed-industries/zed/issues/20925
This prototype is behind a feature flag and being merged to avoid
conflicts with further git-related resturctures.
To be a proper, public feature, this needs at least:
* showing deleted files
* better performance
* randomized tests
* `TODO`s in the `project_diff.rs` file fixed
The good thing is, >90% of the changes are in the `project_diff.rs` file
only, have a basic test and already work on simple cases.
Release Notes:
- N/A
---------
Co-authored-by: Thorsten Ball <thorsten@zed.dev>
Co-authored-by: Cole Miller <cole@zed.dev>
In #20742 we added a call to remove_item that retain an item index over
an
await point. This led to a race condition that could panic if another
tab was
removed during that time. (cc @mgsloan)
This changes the API to make it harder to misuse.
Release Notes:
- Fixed a panic when closing tabs containing new unsaved files
Fixes all sorts of panics around usage of incorrect pinned tab count
that has been fixed in app itself, yet persists in user db.
Closes #ISSUE
Release Notes:
- N/A