Commit Graph

129 Commits

Author SHA1 Message Date
Antonio Scandurra
4700d33728
Fix flickering (#9012)
See https://zed.dev/channel/gpui-536

Fixes https://github.com/zed-industries/zed/issues/9010
Fixes https://github.com/zed-industries/zed/issues/8883
Fixes https://github.com/zed-industries/zed/issues/8640
Fixes https://github.com/zed-industries/zed/issues/8598
Fixes https://github.com/zed-industries/zed/issues/8579
Fixes https://github.com/zed-industries/zed/issues/8363
Fixes https://github.com/zed-industries/zed/issues/8207


### Problem

After transitioning Zed to GPUI 2, we started noticing that interacting
with the mouse on many UI elements would lead to a pretty annoying
flicker. The main issue with the old approach was that hover state was
calculated based on the previous frame. That is, when computing whether
a given element was hovered in the current frame, we would use
information about the same element in the previous frame.

However, inspecting the previous frame tells us very little about what
should be hovered in the current frame, as elements in the current frame
may have changed significantly.

### Solution

This pull request's main contribution is the introduction of a new
`after_layout` phase when redrawing the window. The key idea is that
we'll give every element a chance to register a hitbox (see
`ElementContext::insert_hitbox`) before painting anything. Then, during
the `paint` phase, elements can determine whether they're the topmost
and draw their hover state accordingly.

We are also removing the ability to give an arbitrary z-index to
elements. Instead, we will follow the much simpler painter's algorithm.
That is, an element that gets painted after will be drawn on top of an
element that got painted earlier. Elements can still escape their
current "stacking context" by using the new `ElementContext::defer_draw`
method (see `Overlay` for an example). Elements drawn using this method
will still be logically considered as being children of their original
parent (for keybinding, focus and cache invalidation purposes) but their
layout and paint passes will be deferred until the currently-drawn
element is done.

With these changes we also reworked geometry batching within the
`Scene`. The new approach uses an AABB tree to determine geometry
occlusion, which allows the GPU to render non-overlapping geometry in
parallel.

### Performance

Performance is slightly better than on `main` even though this new
approach is more correct and we're maintaining an extra data structure
(the AABB tree).


![before_after](https://github.com/zed-industries/zed/assets/482957/c8120b07-1dbd-4776-834a-d040e569a71e)

Release Notes:

- Fixed a bug that was causing popovers to flicker.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Thorsten <thorsten@zed.dev>
2024-03-11 10:45:57 +01:00
Evren Sen
1756c1fc1e
Improve UI of popover buttons when hovering over chat messages (#9041)
### Before


https://github.com/zed-industries/zed/assets/146845123/4a16c1ce-a671-4e39-abc9-3a0cb25bc0cd

### After


https://github.com/zed-industries/zed/assets/146845123/cfab3d00-246e-427d-9c40-8ee520a0a186




Release Notes:
- Improved the UI of popover buttons when hovering over chat messages.
2024-03-08 12:46:51 -07:00
Marshall Bowers
22fe03913c
Move Clippy configuration to the workspace level (#8891)
This PR moves the Clippy configuration up to the workspace level.

We're using the [`lints`
table](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table)
to configure the Clippy ruleset in the workspace's `Cargo.toml`.

Each crate in the workspace now has the following in their own
`Cargo.toml` to inherit the lints from the workspace:

```toml
[lints]
workspace = true
```

This allows for configuring rust-analyzer to show Clippy lints in the
editor by using the following configuration in your Zed `settings.json`:

```json
{
  "lsp": {
    "rust-analyzer": {
      "initialization_options": {
        "check": {
          "command": "clippy"
        }
      }
    }
  }
```

Release Notes:

- N/A
2024-03-05 12:01:17 -05:00
Marshall Bowers
373e18bc88
Enable clippy::unnecessary_unwrap (#8756)
This PR enables the
[`clippy::unnecessary_unwrap`](https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_unwrap)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 23:10:56 -05:00
Marshall Bowers
659974411d
Enable clippy::explicit_auto_deref (#8753)
This PR enables the
[`clippy::explicit_auto_deref`](https://rust-lang.github.io/rust-clippy/master/index.html#/explicit_auto_deref)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 22:30:18 -05:00
Marshall Bowers
9735912965
Enable clippy::clone_on_copy (#8728)
This PR enables the
[`clippy::clone_on_copy`](https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_copy)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 17:37:48 -05:00
Marshall Bowers
ca2cda8d2a
Remove unneeded 'static lifetimes on &strs in constants (#8698)
This PR removes unneeded `'static` lifetimes on `&str`s stored in
`const` declarations.

This addresses some Clippy lints about
[`redundant_static_lifetimes`](https://rust-lang.github.io/rust-clippy/master/index.html#/redundant_static_lifetimes).

In item-level `const` declarations we can rely on lifetime elision and
use the default `'static` lifetime.

Note that associated constants still require an explicit `'static`
lifetime, as explained in
https://github.com/rust-lang/rust/issues/115010.

Release Notes:

- N/A
2024-03-02 00:40:49 -05:00
Dzmitry Malyshau
cb75c57fc0
Cleanup dependencies (part 4) (#8468)
Follow-up to #8425 . Final part - adds the CI check.

Release Notes:
- N/A
2024-02-27 20:41:49 +02:00
Dzmitry Malyshau
a44fc24445
Clean up many small dependencies (part 3) (#8425)
Follow-up to #8353

Release Notes:
- N/A
2024-02-26 11:08:57 +02:00
Marshall Bowers
d8276b0f0d
Hoist itertools dependency to workspace level (#8417)
This PR hoists the `itertools` dependency to the workspace level.

Release Notes:

- N/A
2024-02-25 20:37:52 -05:00
Marshall Bowers
841e010fa4
Hoist chrono dependency to workspace level (#8414)
This PR hoists the `chrono` dependency to the workspace level.

Release Notes:

- N/A
2024-02-25 18:52:59 -05:00
Mikayla Maki
cab8b5a9a3
Switch LSP prompts to use a non-blocking toast (#8312)
This fixes a major degradation in usability that some users ran into.

Fixes https://github.com/zed-industries/zed/issues/8255 
Fixes https://github.com/zed-industries/zed/issues/8229

Release Notes:

- Switch from using platform prompts to toasts for LSP prompts.
([8255](https://github.com/zed-industries/zed/issues/8255),
[8229](https://github.com/zed-industries/zed/issues/8229))

<img width="583" alt="Screenshot 2024-02-23 at 2 40 05 PM"
src="https://github.com/zed-industries/zed/assets/2280405/1bfc027b-b7a8-4563-88b6-020e47869668">

Co-authored-by: Marshall <marshall@zed.dev>
2024-02-23 15:18:32 -08:00
Piotr Osiewicz
f17d0b5729
Add static Runnables (#8009)
Part of #7108

This PR includes just the static runnables part. We went with **not**
having a dedicated panel for runnables.
This is just a 1st PR out of N, as we want to start exploring the
dynamic runnables front. Still, all that work is going to happen once
this gets merged.

Release Notes:

- Added initial, static Runnables support to Zed. Such runnables are defined in
`runnables.json` file (accessible via `zed: open runnables` action) and
they can be spawned with `runnables: spawn` action.

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: Pitor <pitor@zed.dev>
Co-authored-by: Beniamin <beniamin@zagan.be>
2024-02-19 18:41:43 +02:00
Marshall Bowers
ef551cedef
Add CheckboxWithLabel component (#7881)
This PR builds on top of #7878 by adding a general-purpose
`CheckboxWithLabel` component to use for checkboxes that have attached
labels.

This component encompasses the functionality of allowing to click on the
label to toggle the value of the checkbox.

There was only one other occurrence of a checkbox with a label—the
"Public" checkbox in the channel management modal—and this has been
updated to use `CheckboxWithLabel`.

Resolves #7794.

Release Notes:

- Added support for clicking the label of the "Public" checkbox in the
channel management modal to toggle the value
([#7794](https://github.com/zed-industries/zed/issues/7794)).
2024-02-15 21:00:30 -05:00
Marshall Bowers
9ef83a2557
Make the labels of the checkboxes on the welcome screen clickable (#7878)
This PR makes the labels of the checkboxes on the welcome screen
clickable.

Release Notes:

- Added support for clicking the labels of the checkboxes on the welcome
screen to toggle the value
([#7794](https://github.com/zed-industries/zed/issues/7794)).
2024-02-15 20:37:31 -05:00
Kirill Bulatov
7c6b34cb73
Close modals and menus before dispathing actions (#7830)
Fixes https://github.com/zed-industries/zed/issues/7799 by forcing the
modal to close before dispatching the action.
While not needed specifically for this case, changed the context menus
to do the same, to be uniform — context menu actions seem to work
properly after this change too.

Release Notes:

- Fixed markdown preview action not working
([7799](https://github.com/zed-industries/zed/issues/7799))
2024-02-15 15:57:32 +02:00
Piotr Osiewicz
743f9b345f
chore: Move workspace dependencies to workspace.dependencies (#7454)
We should prefer referring to local deps via `.workspace = true` from
now on.

Release Notes:

- N/A
2024-02-06 20:41:36 +01:00
Marshall Bowers
ce62404e24
Correctly use the base element in HighlightedLabel (#7397)
This PR updates the `HighlightedLabel` to correctly render its base
element, which is the one that receives the styling properties, instead
of rendering a new `LabelLike`.

Release Notes:

- N/A
2024-02-05 13:21:07 -05:00
Andrew Lygin
2ed45d72d8
File finder UI enhancement (#7364)
File finder looks and feels a little bulky now. It duplicates file names
and consumes too much space for each file.

This PR makes it more compact:
- File name is trimmed from the path, removing duplication
- Path is placed to the right of the file name, improving space usage
- Path is muted and printed in small size to not distract attention from
the main information (file names)

It makes search results easier to look through, consistent with the
editor tabs, and closer in terms of usage to mature editors.

Release Notes:

- File finder UI enhancement
2024-02-05 11:12:47 -07:00
Marshall Bowers
dbb5fad147
Fix some formatting issues in Cargo.toml files (#7127)
This PR fixes some formatting issues in some of the `Cargo.toml` files.

I tried to fix most of these in #7126, but there were a few that I
missed.

Release Notes:

- N/A
2024-01-30 22:01:35 -05:00
Marshall Bowers
e338f34097
Sort dependencies in Cargo.toml files (#7126)
This PR sorts the dependency lists in our `Cargo.toml` files so that
they are in alphabetical order.

This should make them easier to visually scan when looking for a
dependency.

Apologies in advance for any merge conflicts 🙈 

Release Notes:

- N/A
2024-01-30 21:41:29 -05:00
Marshall Bowers
2980f0508c
Rework loading images from files (#7088)
This PR is a follow-up to #7084, where I noted that I wasn't satisfied
with using `SharedUri` to represent both URIs and paths on the local
filesystem:

> I'm still not entirely happy with this naming, as the file paths that
we can store in here are not _really_ URIs, as they are lacking a
protocol.
>
> I want to explore changing `SharedUri` / `SharedUrl` back to alway
storing a URL and treat local filepaths differently, as it seems we're
conflating two different concerns under the same umbrella, at the
moment.

`SharedUri` has now been reverted to just containing a `SharedString`
with a URI.

`ImageSource` now has a new `File` variant that is used to load an image
from a `PathBuf`.

Release Notes:

- N/A
2024-01-30 11:26:02 -05:00
Marshall Bowers
6c7893db35
Rename SharedUrl to SharedUri (#7084)
This PR renames `SharedUrl` to `SharedUri` to better reflect its intent.

I'm still not entirely happy with this naming, as the file paths that we
can store in here are not _really_ URIs, as they are lacking a protocol.

I want to explore changing `SharedUri` / `SharedUrl` back to alway
storing a URL and treat local filepaths differently, as it seems we're
conflating two different concerns under the same umbrella, at the
moment.

Release Notes:

- N/A
2024-01-30 09:54:23 -05:00
Bennet Bo Fenner
dd74643993
gpui: Support loading image from filesystem (#6978)
This PR implements support for loading and displaying images from a
local file using gpui's `img` element.

API Changes:
- Changed `SharedUrl` to `SharedUrl::File`, `SharedUrl::Network`

Usage:
```rust
// load from network
img(SharedUrl::network(...)) // previously img(SharedUrl(...)

// load from filesystem
img(SharedUrl::file(...))
```

This will be useful when implementing markdown image support, because we
need to be able to render images from the filesystem (relative/absolute
path), e.g. when implementing markdown preview #5064.

I also added an example `image` to the gpui crate, let me know if this
is useful. Showcase:
<img width="872" alt="image"
src="https://github.com/zed-industries/zed/assets/53836821/b4310a26-db81-44fa-9a7b-61e7d0ad4349">

**Note**: The example is fetching images from [Lorem
Picsum](https://picsum.photos) ([Github
Repo](https://github.com/DMarby/picsum-photos)), which is a free
resource for fetching images in a specific size. Please let me know if
you're okay with using this in the example.
2024-01-29 21:56:51 -08:00
Marshall Bowers
0cb8b0e451
Clean up Cargo.toml files (#7044)
This PR cleans up some inconsistencies in the `Cargo.toml` files that
were driving me crazy.

Release Notes:

- N/A
2024-01-29 23:47:20 -05:00
Piotr Osiewicz
0a0a866dd5
Licenses: change license fields in Cargo.toml to AGPL-3.0-or-later. (#5535)
Release Notes:
- N/A
2024-01-27 13:51:16 +01:00
Marshall Bowers
c3110d3dce
Rename BellBadged to BellDot (#6820)
This PR renames the `BellBadged` icon to `BellDot` to be a bit clearer
as to what its contents are.

Release Notes:

- N/A
2024-01-26 18:48:16 -05:00
David Rachmaninoff
62365e6a29
Add a badge to the bell icon on new notifications (#6751)
It changes the icon if a new notification event is consumed and changes
it back to normal upon toggling NotificationPanel.

Added a new field to NotificationPanel:
	- have_unseen_notifications: bool

Added a new icon asset
	- IconName::BellBadged => "assets/icons/bell_badged.svg"

Release Notes:

- Added a badge to bell icon for new notifications
([#6721](https://github.com/zed-industries/zed/issues/6721)).
2024-01-26 18:31:17 -05:00
Conrad Irwin
a0f8a2342f Add a hover menu to see who's in a channel
Co-Authored-By: Max <max@zed.dev>
Inspired-By: @RemcoSmitsDev
2024-01-26 12:25:00 -07:00
Marshall Bowers
6103f67875
Make follower avatars smaller (#6724)
This PR makes the avatars of followers in a facepile smaller than the
leader's avatar.

<img width="227" alt="Screenshot 2024-01-25 at 1 42 14 PM"
src="https://github.com/zed-industries/zed/assets/1486634/defc22b4-4ae1-4d63-a0d8-53e3ca8cce04">

Release Notes:

- Adjusted the size of follower avatars to be smaller than the leader.

Co-authored-by: Conrad <conrad@zed.dev>
2024-01-25 13:53:50 -05:00
Mikayla Maki
be4d314858
Revert "Improve completion, action and shared project popovers' layout" (#4233)
Reverts zed-industries/zed#4226

Unfortunately there where some worse states possible after this PR.
Reverting until after the launch, as the problems it addresses are still
bad.

![Screenshot 2024-01-23 at 3 20
59 PM](https://github.com/zed-industries/zed/assets/2280405/d25ab0d5-db49-44cb-b865-e320a97616ce)
2024-01-23 15:34:48 -08:00
Piotr Osiewicz
f2ff7fa4d5
chore: Change AGPL-licensed crates to GPL (except for collab) (#4231)
- [x] Fill in GPL license text.
- [x] live_kit_client depends on live_kit_server as non-dev dependency,
even though it seems to only be used for tests. Is that an issue?

Release Notes:
- N/A
2024-01-24 00:26:58 +01:00
Mikayla Maki
9f6072c6b6
Revert "Improve completion, action and shared project popovers' layout" 2024-01-23 15:26:11 -08:00
Kirill Bulatov
513ddf1861 Change background for the max width of the completion/action elements 2024-01-23 22:12:29 +02:00
Piotr Osiewicz
21e6b09361
Remove license-file from Cargo.toml as it is apparently redundant (#4218)
Release Notes:

- N/A
2024-01-23 17:40:30 +01:00
Piotr Osiewicz
678bdddd7d
chore: Add crate licenses. (#4158)
- GPUI and all dependencies: Apache 2
- Everything else: AGPL

Here's a script that I've generated for it:
https://gist.github.com/osiewicz/6afdd6626e517da24a2092807e6f0b6e

Release Notes:
- N/A

---------

Co-authored-by: David <david@zed.dev>
2024-01-23 16:56:22 +01:00
Julia
2c3d9805a4 Store a z-index id per-layer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2024-01-22 10:16:59 -05:00
Mikayla
c05edee2b5
Port the rest of the app 2024-01-21 20:26:33 -08:00
Piotr Osiewicz
6c82380232 chore: Fix clippy::needless_borrow up to an editor 2024-01-21 15:03:24 +01:00
Mikayla
a44aae9e91
Finish documenting the action, asset, color, and element modules in GPUI
Remove SmallVec from the public API of GPUI
2024-01-20 20:15:23 -08:00
Conrad Irwin
23d991962a Link previews in chat 2024-01-19 16:59:17 -07:00
Marshall Bowers
1cc7f66f86
Fix documentation labels obscuring other content in completion menu (#4167)
This PF fixes an issue where the documentation labels in the completion
menu could end up completing obscuring the primary content.

#### Before
<img width="691" alt="Screenshot 2024-01-19 at 1 42 19 PM"
src="https://github.com/zed-industries/zed/assets/1486634/187f2978-08be-4f5e-ba93-91ed09cd6e87">

#### After

<img width="704" alt="Screenshot 2024-01-19 at 1 39 45 PM"
src="https://github.com/zed-industries/zed/assets/1486634/e5929c04-bace-4336-b878-4ada5660d235">

Since this involved changes to the `ListItem`, I also made sure to test
the other problematic case that was fixed in #3845 to make sure we
didn't regress there:

<img width="665" alt="Screenshot 2024-01-19 at 1 39 11 PM"
src="https://github.com/zed-industries/zed/assets/1486634/14b72d44-b6a6-4aef-a708-37fb60b8875a">

I also tried to capture these cases in the `ListItem` stories to make it
easier to test all of them at once:

<img width="1141" alt="Screenshot 2024-01-19 at 1 40 03 PM"
src="https://github.com/zed-industries/zed/assets/1486634/333886ff-e394-4cba-89db-98352481c7f6">

Release Notes:

- Fixed an issue where documentation labels could obscure other content
in the editor completion menu
([#2419](https://github.com/zed-industries/community/issues/2419)).
2024-01-19 14:01:09 -05:00
Marshall Bowers
01f06f96a1
Update tenses of doc comment summary lines (#4161)
This PR updates the tenses used by the summary line of doc comments to
match the [Rust API documentation
conventions](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#summary-sentence).

Specifically:

> The summary line should be written in third person singular present
indicative form. Basically, this means write ‘Returns’ instead of
‘Return’.

I'm sure there are plenty occurrences that I missed.

Release Notes:

- N/A
2024-01-19 11:18:50 -05:00
Marshall Bowers
03826be196
Fix docs references in ui (#4147)
This PR fixes some more references in the docs in the `ui` crate.

Release Notes:

- N/A
2024-01-18 22:52:30 -05:00
Marshall Bowers
decf320a74
Rename overflow_hidden_{x,y} to overflow_{x,y}_hidden (#4146)
This PR renames the `overflow_hidden_x` and `overflow_hidden_y` methods
to `overflow_x_hidden` and `overflow_y_hidden`, respectively.

This provides consistency with our `overflow_x_scroll` /
`overflow_y_scroll` methods, as well as better matches Tailwind's
naming.

Release Notes:

- N/A
2024-01-18 22:10:41 -05:00
Mikayla Maki
20b58fea35
Merge branch 'main' into fix-popin-for-project-panel 2024-01-18 15:55:35 -08:00
Mikayla
903176d8ff
Pull out fluent builder helpers into re-usable trait 2024-01-18 15:31:31 -08:00
Marshall Bowers
0691ad480b
Make clicking ListHeader labels toggle the disclosure (#4140)
This PR makes clicking the label inside of a `ListHeader` with a
disclosure also toggle the disclosure.

Release Notes:

- Added support for clicking the "Online", "Offline", and "Requests"
headers in the contact list to toggle their expansion.
2024-01-18 18:21:53 -05:00
Mikayla
a5084510a1
Fix popin for project panel by pre-resolving keybindings in terms of the project panel 2024-01-18 15:16:09 -08:00
Conrad Irwin
6c2da0d25b Revert "Store a z-index id per-layer (#4128)"
This reverts commit 28a2337218, reversing
changes made to e992f84735.
2024-01-18 13:28:23 -07:00