Commit graph

2002 commits

Author SHA1 Message Date
Nate Butler
5397ca23a1
ui: More component previews, UI component cleanup (#25302)
- Don't require ui component docs (this isn't really working)
- Add more component previews
- Update component preview style & navigation

Release Notes:

- N/A
2025-02-21 09:20:53 -05:00
Conrad Irwin
4871d3c9e7
New commit review flow in project diff view (#25229)
Closes #ISSUE

Release Notes:

- N/A

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
2025-02-21 06:52:34 +00:00
Mikayla Maki
cc46a1fe30
Add an action to toggle the outline from the buffer search bar (#25225)
This was annoying.

Release Notes:

- Fixed a bug where you couldn't open the outline modal when focus was
in the buffer search bar.
2025-02-20 05:23:10 +00:00
Marshall Bowers
af6cdd87cd
workspace: Remove stray println! (#25189)
This PR removes a stray `println!` that was left over from #25185.

Release Notes:

- N/A
2025-02-19 20:24:00 +00:00
Mikayla Maki
40425093df
Add last window closed setting (#25185)
Release Notes:

- Added an `on_last_window_closed` setting, that allows users to quit
the app when the last window is closed

---------

Co-authored-by: Richard <richard@zed.dev>
2025-02-19 20:03:10 +00:00
Cole Miller
c0c48d30db
Revert "file_finder: Remove common segments of long paths in search results (#25049)" (#25163)
This reverts commit 9ef0501853 due to a
panic.

```
{
  "thread": "main",
  "payload": "9 is not a valid char boundary in path \"crates/…/LiveKitBridge/\"",
  "location_data": {
    "file": "crates/file_finder/src/file_finder.rs",
    "line": 646
  }
}
```

Release Notes:

- N/A
2025-02-19 15:32:29 +00:00
Michael Sloan
b1872e3afd
cx.background_executor().spawn(...) -> cx.background_spawn(...) (#25103)
Done automatically with

> ast-grep -p '$A.background_executor().spawn($B)' -r
'$A.background_spawn($B)' --update-all --globs "\!crates/gpui"

Followed by:

* `cargo fmt`
* Unexpected need to remove some trailing whitespace.
* Manually adding imports of `gpui::{AppContext as _}` which provides
`background_spawn`
* Added `AppContext as _` to existing use of `AppContext`

Release Notes:

- N/A
2025-02-18 20:30:33 +00:00
Cole Miller
9ef0501853
file_finder: Remove common segments of long paths in search results (#25049)
This PR makes progress on #7711 by identifying any common prefix of the
paths in the file finder's search results, and replacing the "interior"
of that prefix---every path segment but the first and last---with `...`,
when a heuristic indicates that the longest path would otherwise
overflow the modal.

The elision is not applied to any segment that contains a match for the
search query.

There may be more work to do on #7711 in the case of long result paths
that do not share a significant common prefix.

Release Notes:

- Improved display of long paths in the file finder modal

Co-authored-by: Max <max@zed.dev>
2025-02-18 10:09:15 -05:00
Kirill Bulatov
80458ffb96
Persist selections for editors (#25083)
Part of https://github.com/zed-industries/zed/issues/7371
Closes https://github.com/zed-industries/zed/issues/12853

Release Notes:

- Started to persist latest selections for editors, to restore those on
restart
2025-02-18 14:27:00 +00:00
Dylan
bb53ad9862
Only allow save_as for pane if can_save_as is true (#25028)
When saving an item, some logic is done to determine whether one can
save it. In the special case where the intent is to `SaveAs`, it was
previously allowed to proceed as long as the buffer was a singleton
(presumably since it only makes sense to provide a save path for a
single file). However, we need to _also_ check that this item can be
"saved as" at all.

For this, we resurrect the `ItemHandle`/`Item` trait method
`can_save_as`. We have given it the default implementation of returning
`false`, and then overridden this in the implementation for
`TerminalView`.

Closes #25023


Release Notes:

- Fixed crash when trying to save terminal buffer

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-02-17 16:01:56 -07:00
Danilo Leal
a99696b95f
pane: Disable the "Close..." controls depending on certain scenarios (#25037)
Closes https://github.com/zed-industries/zed/issues/12471

- Disables "Close Others" if there's just one tab
- Disables "Close Left"/"Close Right" if the above is true or if there's
no tabs to the left/right side of the active tab

Release Notes:

- N/A
2025-02-17 18:01:13 -03:00
Danilo Leal
510260a10e
Use the MessageNotification component for the release notes toast (#25013)
Closes https://github.com/zed-industries/zed/issues/24981

Release Notes:

- N/A

---------

Co-authored-by: smit <0xtimsb@gmail.com>
2025-02-17 11:32:04 -03:00
Conrad Irwin
79e3faffb2
Make save all prompt less noisy (#24934)
Don't show clean items from dirty multibuffers, and dedupe filenames in
case you have a file open in a buffer and a multibuffer

Release Notes:

- N/A
2025-02-14 22:40:14 -07:00
Kirill Bulatov
744579ede9
Move git status updates to a background thread #2 (#24722)
Follow-up of https://github.com/zed-industries/zed/pull/24307

Brings back the PR and fixes the issue with the git status not
propagated, if computed too slow.
Now, git repo update
* waits in the background for all `scan_dir` repo status updates and
triggers another status update send afterwards
* ensures that the update sent is reported correctly (`scanning = true`)
if either FS or status scan is running still
* during worktree's git statuses updates, bumps `status_scan_id` to
ensure the repo update is reported to all subscribers

Release Notes:

- Improved project panel's speed in large projects
2025-02-14 16:47:11 +02:00
Mikayla Maki
5d26ce14d7
Centralize the CopyPath and CopyRelativePath actions to zed_actions (#24836)
I spent an hour with @marcospb19 this morning debugging an issue with
adding `Copy Path` and `Copy Relative Path` actions to the editor
context menu. Turned out that the problem was using
`workspace::CopyPath` in the menu and `editor::CopyPath` in the action
handler.

This is an easy mistake to make, so let's fix it for everyone.

Release Notes:

- N/A
2025-02-13 23:30:44 +00:00
Conrad Irwin
2f741c8686
vim: Fix :wq in multibuffer (#24603)
Supercedes #24561
Closes #21059

Before this change we would skip saving multibuffers regardless of the
save intent. Now we correctly save them.

Along the way:
* Prompt to save when closing the last singleton copy of an item (even
if it's still open in a multibuffer).
* Update our file name prompt to pull out dirty project items from
multibuffers instead of counting multibuffers as untitled files.
* Fix our prompt test helpers to require passing the button name instead
of the index. A few tests were passing invalid responses to save
prompts.
* Refactor the code a bit to hopefully clarify it for the next bug.

Release Notes:

- Fixed edge-cases when closing multiple items including multibuffers.
Previously no prompt was generated when closing an item that was open in
a multibuffer, now you will be prompted.
- vim: Fix :wq in a multibuffer
2025-02-13 17:13:43 +00:00
smit
5dc3c237eb
workspace: Do not reuse window for sub directory (only for root directory and sub files) (#24560)
Closes #10232

Context:

We have three ways to open files or dirs in Zed: `zed`, `zed --new`, and
`zed --add`. `--new` forces the project to open in a new window, while
`--add` forces it to open in an existing window (even if the dir isn’t a
subdir of an existing project or the file isn’t part of it).

Using just `zed` tries to open it in an existing window based on similar
logic of `--add`, but if no related project is found the dir, opens in a
new window.

Problem:

Right now, subdirs that are part of an existing project open in the
existing window when using `zed`. By default, subdirs should open in a
new window instead. If someone wants to open it in the existing window,
they can explicitly use `--add`. After this PR, only root dir and files
will focus on existing window, when `zed ` is used.

Fix:

For the `zed` case, we’ve filtered out subdirs in the logic that assigns
them to an existing window.

Release Notes:

- Fixed an issue where subdirectories of an already opened project, when
opened via the terminal, would open in the existing project instead of a
new window.
2025-02-13 03:37:39 +05:30
Marshall Bowers
cc931a8fcc
theme: Add support for setting light/dark icon themes (#24702)
This PR adds support for configuring both a light and dark icon theme in
`settings.json`.

In addition to accepting just an icon theme name, the `icon_theme` field
now also accepts an object in the following form:

```jsonc
{
  "icon_theme": {
    "mode": "system",
    "light": "Zed (Default)",
    "dark": "Zed (Default)"
  }
}
```

Both `light` and `dark` are required, and indicate which icon theme
should be used when the system is in light mode and dark mode,
respectively.

The `mode` field is optional and indicates which icon theme should be
used:
- `"system"` - Use the icon theme that corresponds to the system's
appearance.
- `"light"` - Use the icon theme indicated by the `light` field.
- `"dark"` - Use the icon theme indicated by the `dark` field.

Closes https://github.com/zed-industries/zed/issues/24695.

Release Notes:

- Added support for configuring both a light and dark icon theme and
switching between them based on system preference.
2025-02-11 23:45:37 +00:00
CharlesChen0823
994bea0003
workspace: Fix pane focus transfer when closing another pane (#23175)
Closes #23123 

Only close current active_pane should move focus to other pane.

Release Notes:

- N/A
2025-02-10 11:54:06 +02:00
Kirill Bulatov
6f7f0f30e2
Fix hover tooltips appearing after related element is pressed (#24540)
Closes https://github.com/zed-industries/zed/issues/23894

Reworks all trigger declarations from
`.trigger(element.tooltip(tooltip))` into
`.trigger_with_tooltip(element, tooltip)` , with new API disallowing
simultaneous trigger and tooltip display.

All existing `.trigger(` calls were replaced, except 2 not applicable
(in dock.rs and pane.rs), 15 left as ones without tooltips, and 2
unchanged places in `inline_completion_button.rs`, where


0f7bb2e9fd/crates/inline_completion_button/src/inline_completion_button.rs (L311-L319)

`with_animation` does not allow us to simply use the same approach.

Release Notes:

- Fixed hover tooltips appearing after related element is pressed

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2025-02-10 00:16:12 +00:00
Michael Sloan
1a133ab9d8
Settings/keymap backup path next to files + update notification messages (#24517)
Before:


![image](https://github.com/user-attachments/assets/5b7d8677-b0db-4a66-ac30-e4751ba4182d)

After:


![image](https://github.com/user-attachments/assets/94743bc2-2902-43a3-8d6e-e0e0e6e469ec)

Release Notes:

- N/A
2025-02-09 16:51:37 -07:00
Nate Butler
8f1ff189cc
component: Add component and component_preview crates to power UI components (#24456)
This PR formalizes design components with the Component and
ComponentPreview traits.

You can open the preview UI with `workspace: open component preview`.

Component previews no longer need to return `Self` allowing for more
complex previews, and previews of components like `ui::Tooltip` that
supplement other components rather than are rendered by default.

`cargo-machete` incorrectly identifies `linkme` as an unused dep on
crates that have components deriving `IntoComponent`, so you may need to
add this to that crate's `Cargo.toml`:

```toml
# cargo-machete doesn't understand that linkme is used in the component macro
[package.metadata.cargo-machete]
ignored = ["linkme"]
```

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-02-09 13:25:03 -05:00
smit
44c6a54f95
pane: Improve close active item to better handle pinned tabs (#23488)
Closes #22247

- [x] Do not close pinned tab on keyboard shortcuts like `ctrl+w` or
`alt+f4`
- [x] Close pinned tab on context menu action, menu bar action, or vim
bang
- [x] While closing pinned tab via shortcut (where it won't close),
instead activate any other non-pinned tab in same pane
- [x] Else, if any other pane contains non-pinned tab, activate that
- [x] Tests

Co-authored-by: uncenter <47499684+uncenter@users.noreply.github.com>

Release Notes:

- Pinned tab now stay open when using close shortcuts, auto focuses to
any other non-pinned tab instead.
2025-02-07 22:54:57 +05:30
smit
00c2a30059
Migrate keymap and settings + edit predictions rename (#23834)
- [x] snake case keymap properties
- [x] flatten actions
- [x] keymap migration + notfication
- [x] settings migration + notification
- [x] inline completions -> edit predictions 

### future: 
- keymap notification doesn't show up on start up, only on keymap save.
this is existing bug in zed, will be addressed in seperate PR.

Release Notes:

- Added a notification for deprecated settings and keymaps, allowing you
to migrate them with a single click. A backup of your existing keymap
and settings will be created in your home directory.
- Modified some keymap actions and settings for consistency.

---------

Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2025-02-07 21:17:07 +05:30
Michael Sloan
92c21a2814
Fix undismissed app notifications appearing on new workspaces (#24437)
Bug in #23817

Release Notes:

- N/A
2025-02-07 10:29:05 +00:00
Nate Butler
00971fbe41
Introduce KeybindingHint (#24397)
- Implements scaling for `ui::Keybinding` and it's component parts
- Adds the `ui::KeybindingHint` component for creating keybinding hints
easily:

![CleanShot 2025-02-04 at 16 59
38@2x](https://github.com/user-attachments/assets/d781e401-8875-4edc-a4b0-5f8750777d86)

Release Notes:

- N/A
2025-02-06 21:45:03 +00:00
Nate Butler
6d81ad1e0b
git_ui: Start unifying panel style with other panels (#24296)
- Adds the `panel` crate for defining UI shared between panels, like
common button and header designs, etc
- Starts to update the git ui to be more consistent with other panels

Release Notes:

- N/A
2025-02-05 13:54:14 -05:00
Danilo Leal
37db1dcd48
Revise the MessageNotification component (#24287)
This PR makes adding icons to the primary and secondary actions, in the
`MessageNotification` component, optional. Also took the opportunity to
remove a probably unnecessary "third action" from it; streamlining the
component API (we had added that for a design that we're not using
anymore). I did keep the "more info" possibility, which may be useful in
the future, though.

Release Notes:

- N/A
2025-02-05 13:39:27 -03:00
Mikayla Maki
69bb0a0597
Fix slow focus transitions to the terminal panel (#24172)
This long standing bug was caused by `Pane`'s focus_in handler bouncing
the focus to another handle.
Because focus resolution happens _after_ a frame has been rendered, the
only way to deal with this case is to schedule another frame to be
redrawn. However, we where suppressing all window refreshes that occur
during a focus transfer, causing this focus change to be completely
missed. However, changing this behavior can lead to infinite notify
loops, due to drawing a frame causing another to be rendered.

This PR fixes this problem narrowly by adding an `on_next_frame()`
callback in the pane's focus handle, so that the focus changes take
effect almost immediately. But only for this case, where we know it
doesn't cause infinite notify loops.

TODO:
- [x] Fix the infinite notify loop bug or determine a third way to fix
this lag

Release Notes:

- Fixed a bug where shifting focus to the terminal panel could be slow
2025-02-04 20:23:20 +00:00
Anthony Eid
8c7096f7a6
Rename model based variable names to entity (#24198)
## Context
While looking through the client crate, I noticed that some of the old
functions and variables were still using gpui::model name that was
deprecated during the gpui3 transition. This PR renames those instances
of model to entity to be more inline with gpui3.

In addition, I also renamed `model` to `entity` in cases found by the
below search terms given by @someone13574

- model = cx.
- model: Entity
- model: &Entity
- OpenedModelHandle
- model.update
- model.upgrade
- model = .*\.root (regex)
- parent_model
- model = cx.new
- cx.spawn(move |model

Release Notes:

- N/A
2025-02-04 10:24:35 -08:00
Danilo Leal
e5c3273486
status_bar: Only show divider for left dock (#24178)
Follow up to https://github.com/zed-industries/zed/pull/24114

Just fixing the UI so that the divider only shows for the
left-positioned items.

Release Notes:

- N/A
2025-02-04 08:02:29 +00:00
Joseph T. Lyons
a8741dc310
Migrate more events to telemetry::event! macro (#24102)
I believe this takes care of the remaining events running through the
old flow that requires transformation at the collab server level. I
think all events are now going through `telemetry::event!()`.

For anyone curious where the new telemetry names are coming from, you
can check the `for_snowflake` function within
`crates/collab/src/api/events.rs`, to see how collab is currently
transforming the events going through the old flow.

Release Notes:

- N/A
2025-02-03 16:38:45 +00:00
Piotr Osiewicz
6b48a6e690
workspace: Respect minimized state when deserializing workspaces (#24127)
Fixes a regression from #24015 pointed out in #24093

Closes #24093

Release Notes:

- N/A
2025-02-03 12:35:16 +00:00
Kevin Sweet
f14ef40a13
Conditionally render divider between button groups in the status bar (#24114)
In the left hand status bar, there are two groups of buttons. There was
a border between the two hardcoded on the first button of the second
group, however, if all buttons in the first group are hidden, the border
doesn't need to be rendered.

(Not handled in this PR) A potentially better approach would be to
change StatusBar's definition from `left_items` and `right_items` to
`left_groups` and `right_groups`, and render dividers between each group
of items. That seemed like a bigger refactor than I wanted to handle for
now, but is an option for the future.

If you use these settings on `main`, the border will show, but with
nothing to the left of it.

```json
{
  "collaboration_panel": {
    "button": false
  },
  "outline_panel": {
    "button": false
  },
  "project_panel": {
    "button": false,
  },
}
```

Screenshots:

Before:
<img width="117" alt="Screenshot 2025-02-02 at 6 19 24 PM"
src="https://github.com/user-attachments/assets/b3401b47-6172-4392-9277-31aa1affaf7a"
/>
<img width="134" alt="Screenshot 2025-02-02 at 6 20 12 PM"
src="https://github.com/user-attachments/assets/1e8caee6-1da8-47f6-8499-9a93b6d8fa27"
/>

After:
<img width="125" alt="Screenshot 2025-02-02 at 6 19 58 PM"
src="https://github.com/user-attachments/assets/9b9f421c-660b-41cb-80e0-acb774c66054"
/>
<img width="132" alt="Screenshot 2025-02-02 at 6 20 20 PM"
src="https://github.com/user-attachments/assets/87e0e475-084b-44df-b820-573c68728c1a"
/>

Release Notes:

- Conditionally render divider in status bar

---------

Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
2025-02-03 04:13:40 +00:00
Piotr Osiewicz
4885ace107
workspace: Prevent clicks from falling through on some notifications (#24104)
Closes #ISSUE

Release Notes:

- N/A
2025-02-02 19:39:13 +00:00
AidanV
d0152f9eb4
vim: Add keybindings for resizing docks (#23874)
Closes #23334

This does not follow the exact way that windows are resized in vim.
Normally the command is `ctrl-w >` however this PR uses just `ctrl->`.
This is because I could not find a good way to read in a count like `10
ctrl-w ctrl->`. This is not really a problem since `ctrl->` can be held
down, which, in my opinion, speeds up resizing. I think this is a good
compromise since it improves usability; however, I am concerned that
this is not intuitive. I am looking forward to feedback.

Release Notes:

- Added the following commands 
  - vim::ResizeLeftDock
  - vim::ResizeRightDock
  - vim::ResizeBottomDock
- Added keybinds
  - `ctrl->` for widening left dock
  - `ctrl-<` for narrowing left dock
2025-01-31 21:50:16 -07:00
Piotr Osiewicz
be4c3cfbd2
workspace: Make "New Window" bring app to foreground (#24015)
Closes #ISSUE

Release Notes:

- "New Window" action will now bring App to foreground.
2025-01-31 11:18:56 +01:00
Conrad Irwin
f2b3f3a9ab
Allow buffer search in project search (#23819)
Closes #13437
Closes #19993

Release Notes:

- Allow searching within the results of a project search
- vim: Fix `/`/`?`, `n`/`N`, `gn`/`gN`,`*`/`#` in project search results

---------

Co-authored-by: Nico <nico.lehmann@gmail.com>
2025-01-31 00:13:46 -07:00
Agus Zubiaga
e23e03592b
zeta: Onboarding and title bar banner (#23797)
Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Danilo <danilo@zed.dev>
Co-authored-by: João Marcos <joao@zed.dev>
2025-01-30 16:55:32 -03:00
Nate Butler
a03b7624f1
Revert "gpui & ui: Use shader for dashed dividers" (#23850)
Reverts zed-industries/zed#23839

getting some reports of linux crashes – will investigate later today

Release Notes:

- N/A
2025-01-29 19:19:20 +00:00
Nate Butler
e5943975f9
gpui & ui: Use shader for dashed dividers (#23839)
TODO:
- [x] BackgroundOrientation
- [x] PatternDash
- [x] `pattern_horizontal_dash` & `pattern_vertical_dash`
- [x] Metal dash shader
- [x] Blade dash shader
- [x] Update ui::Divider to use new pattern

---

This PR introduces proper dashed dividers using the new `PatternDash`
background shader.

![CleanShot 2025-01-29 at 09 33
06@2x](https://github.com/user-attachments/assets/2db5af58-1aa9-4ad7-aa52-b9046fbf8584)

Before this we were using 128 elements to create a dashed divider, which
is both expensive, and would not scale beyond a certain size. This
allows us to simplify the divider element as well.

Changes:

- Adds `BackgroundOrientation` to `gpui::color::Background` to allow
specifying a direction for a pattern
- Adds the PatternDash pattern variant
- Updates `ui::Divider`'s dashed variants to be more efficient

Misc:
- Documents the `ui::Divider` component
- Treat `.metal` files as `C` in the Zed project until we get some metal
syntax highlighting.

Release Notes:

- N/A
2025-01-29 12:18:34 -05:00
Michael Sloan
dbdf140ca1
Show settings file errors on startup (#23817)
Required using a global `LazyLock<Mutex<AppNotifications>>` instead of a
context global because settings errors first occur before initialization
of the notifications global.

Release Notes:

- Errors in settings file are now reported in UI on startup.
2025-01-29 07:05:33 +00:00
Richard Feldman
33d1145c3f
Refactor to use SharedString in more places (#23813)
Splitting this off from
https://github.com/zed-industries/zed/pull/23808, per @maxdeviant's
suggestion!

Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2025-01-28 19:04:21 -05:00
tims
d090caccd7
workspace: Prefer active window over other local non-collab windows for opening file (#23726)
Closes #21625 #17401 #16426

This is how the opening of a file works currently:

1. We first check if the file is part of any existing worktree. If it
is, we focus on that file in the worktree, and the window is activated.
2. If the file is not part of any worktree, we open it in the first
local non-collab workspace we find and activate that window. This is the
bug that the issues are based on.

This PR fixes it by modifying the second part of the above step, where
the file is not part of any worktree. Now, we will first open the file
in the active window, but only if the active window is local and
non-collab. This resolves the issue. If the file can't be opened in the
active window due to the local non-collab check, we will carry out the
existing logic of opening the file in whichever window is local and
non-collab.

I have tested this using the "workspace::OpenFiles" action, and
"workspace::Open" also uses the same method. That is, it will work on
all platforms.

Future: Some users also mentioned there should be a setting for whether
we should open a non-workspace file in the existing window or in a
separate new window. However, this seems out of scope, and a new issue
should be created for this.

#9370 is related, but this likely doesn't fix it, as it deals with how
macOS Finder's "Open with" handles files. I don't have macOS to test,
but this PR won't resolve it if Finder always opens a new window.

Release Notes:

- Fixed the issue where a file outside of the workspace was opening in a
random window instead of the last active window.
2025-01-27 23:11:35 -07:00
Danilo Leal
5331418f3a
pane: Add settings to hide the tab bar buttons (#23752)
This PR adds the `show_tab_bar_buttons` under `tab_bar` that allows
hiding the "New", "Split Pane", and "Zoom" buttons to the left of the
pane tab bar.

Release Notes:

- Added a new `show_tab_bar_buttons` setting, under `tab_bar`, that
enables hiding the pane tab bar buttons.
2025-01-27 21:36:33 -03:00
Mikayla Maki
a7c549b85b
Fix window double borrows (#23739)
Fix bugs caused by the window context PR, where the window could be on
the stack and is then requested from the App.
This PR also adds derive macros for `AppContext` and `VisualContext` so
that it's easy to define further contexts in API code, such as
`editor::BlockContext`.

Release Notes:

- N/A
2025-01-27 21:56:29 +00:00
Mikayla Maki
9cae96f82f
Remove more references to 'model' in GPUI APIs (#23693)
Release Notes:

- N/A
2025-01-27 04:00:27 +00:00
Mikayla Maki
a6b1514246
Fix missed renames in #22632 (#23688)
Fix a bug where a GPUI macro still used `ModelContext`
Rename `AsyncAppContext` -> `AsyncApp`
Rename update_model, read_model, insert_model, and reserve_model to
update_entity, read_entity, insert_entity, and reserve_entity

Release Notes:

- N/A
2025-01-26 23:37:34 +00:00
Joseph T. Lyons
0c8ee21e22
Clean up duplicate dock-retrieval code (#23670)
Release Notes:

- N/A
2025-01-26 09:11:38 +00:00
Nathan Sobo
6fca1d2b0b
Eliminate GPUI View, ViewContext, and WindowContext types (#22632)
There's still a bit more work to do on this, but this PR is compiling
(with warnings) after eliminating the key types. When the tasks below
are complete, this will be the new narrative for GPUI:

- `Entity<T>` - This replaces `View<T>`/`Model<T>`. It represents a unit
of state, and if `T` implements `Render`, then `Entity<T>` implements
`Element`.
- `&mut App` This replaces `AppContext` and represents the app.
- `&mut Context<T>` This replaces `ModelContext` and derefs to `App`. It
is provided by the framework when updating an entity.
- `&mut Window` Broken out of `&mut WindowContext` which no longer
exists. Every method that once took `&mut WindowContext` now takes `&mut
Window, &mut App` and every method that took `&mut ViewContext<T>` now
takes `&mut Window, &mut Context<T>`

Not pictured here are the two other failed attempts. It's been quite a
month!

Tasks:

- [x] Remove `View`, `ViewContext`, `WindowContext` and thread through
`Window`
- [x] [@cole-miller @mikayla-maki] Redraw window when entities change
- [x] [@cole-miller @mikayla-maki] Get examples and Zed running
- [x] [@cole-miller @mikayla-maki] Fix Zed rendering
- [x] [@mikayla-maki] Fix todo! macros and comments
- [x] Fix a bug where the editor would not be redrawn because of view
caching
- [x] remove publicness window.notify() and replace with
`AppContext::notify`
- [x] remove `observe_new_window_models`, replace with
`observe_new_models` with an optional window
- [x] Fix a bug where the project panel would not be redrawn because of
the wrong refresh() call being used
- [x] Fix the tests
- [x] Fix warnings by eliminating `Window` params or using `_`
- [x] Fix conflicts
- [x] Simplify generic code where possible
- [x] Rename types
- [ ] Update docs

### issues post merge

- [x] Issues switching between normal and insert mode
- [x] Assistant re-rendering failure
- [x] Vim test failures
- [x] Mac build issue



Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Joseph <joseph@zed.dev>
Co-authored-by: max <max@zed.dev>
Co-authored-by: Michael Sloan <michael@zed.dev>
Co-authored-by: Mikayla Maki <mikaylamaki@Mikaylas-MacBook-Pro.local>
Co-authored-by: Mikayla <mikayla.c.maki@gmail.com>
Co-authored-by: joão <joao@zed.dev>
2025-01-26 03:02:45 +00:00