Commit Graph
39175 Commits
Author SHA1 Message Date
Nate Butler 7a4e518879 Update toolbar.rs 2023-11-21 11:06:27 -05:00
Marshall Bowers 027f2eaefd Fix panic when opening settings in zed2 (#3375)
This PR fixes a panic that occurs when opening the settings in zed2.

We store the `ThemeRegistry` as a global without wrapping it in an
`Arc`, so we need to retrieve it the same way.

Release Notes:

- N/A
2023-11-21 10:58:52 -05:00
Nate Butler cf0c36763c Update default ui font settings 2023-11-21 10:43:18 -05:00
Nate Butler 0fe4620ce6 ui2 cleanup (#3374)
[[PR Description]]

Tidies up the `ui2` crate, removing all components we aren't using and
doing a bit of reorganization.

Release Notes:

- N/A
2023-11-21 01:55:00 -05:00
Nate Butler 91c6a6513f Remove stories mod until it is re-enabled 2023-11-21 01:36:35 -05:00
Nate Butler 7d2f068492 Update elevation 2023-11-21 01:23:47 -05:00
Nate Butler 374d4b9557 TextColor -> Color 2023-11-21 01:05:29 -05:00
Nate Butler 1a2abb4f00 Add Shape enum to avatar component, refactor UITextSize to styles/typography.rs 2023-11-21 00:59:29 -05:00
Nate Butler 48d7cfeebf Clean out UI 2023-11-21 00:44:51 -05:00
Piotr Osiewicz 0929984bf7 Search2 (#3332)
This is just a buffer search (without project search), as the latter
needs a multibuffer from `editor`
Release Notes:

- N/A
2023-11-21 01:38:14 +01:00
Mikayla Maki 4ca17d68a7 WIP: Remove V parameter on elements (#3366)
This is an exploration of what it would take to remove the `V` generic
from the element type. Answer: less than I expected.

I added a new struct to GPUI2: `CallbackHandle<Event>`, and reworked the
interactivity related APIs to take this type. I also added a
`.callback()` function to `ViewContext` that can construct a
`CallbackHandle` to wrap our current `|&mut View, &Evt, &mut
ViewContext| {...}` based APIs. With these two changes, we can now
capture the context of the callsite of a click handler, allowing us to
capture all relevant types and data _before_ sending them into GPUI.
This lets us achieve a similar programing style to the existing system,
while also letting us remove all of the generics from the entire element
system. For an example of what this looks like in practice, here's a
side by side diff of the test in `interactive.rs` (which compiles and
passes):

<img width="1310" alt="Screenshot 2023-11-19 at 7 32 08 PM"
src="https://github.com/zed-industries/zed/assets/2280405/596f2a9a-9c8e-4158-bf6d-0003cf973015">

Note how the new arrangement of types is more amenable to rust's type
inference, allowing the code to be just as terse as before despite the
extra function call in the middle.

This approach also allows components to provide well typed APIs to
views, without ever knowing that view's type. This PR includes an
example rewrite of the button component in `ui2`, here's what it's
struct could look like now:

<img width="1105" alt="Screenshot 2023-11-19 at 7 24 28 PM"
src="https://github.com/zed-industries/zed/assets/2280405/fc98d3c2-6831-4c0f-a324-ab0fae33b0bc">

However, I have not yet ported the derive macro for Component to this
new structure, as I know @nathansobo is currently reworking that code.

Once that macro has been rewritten, it should be relatively easy to
rewrite the rest of Zed2 with this approach, the only major difference
that I can foresee is that the editor element would need to wrap it's
operations in an update callback. Though I can think of a few ways to
fix this with a new `ViewElement` trait, that does the wrapping for you.
2023-11-20 16:24:01 -08:00
Piotr Osiewicz c75fa798f7 Merge remote-tracking branch 'origin/callback-handles' into search2 2023-11-21 01:16:21 +01:00
MikaylaandPiotrek 1b241aebbf Fix stories
co-authored-by: Piotrek <piotr@zed.dev>
2023-11-20 16:06:10 -08:00
Piotr OsiewiczandMikayla a72030054e Brave new world awaits
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-11-21 00:47:47 +01:00
Piotr Osiewicz b05280f8cb Merge remote-tracking branch 'origin/callback-handles' into search2 2023-11-21 00:40:20 +01:00
Conrad Irwin dbc46eb65f Fix last thing 2023-11-20 16:35:56 -07:00
Conrad Irwin d3983f54af Remove all the settings 2023-11-20 16:30:14 -07:00
Conrad Irwin 897a7e7690 Merge branch 'main' into callback-handles 2023-11-20 16:28:35 -07:00
Nate Butler c1f00a6f08 Add deploy-docs script (#3373)
[[PR Description]]

Adds `script/deploy-docs`:
- If you don't already have it, it will clone the `zed-docs` repo into
`../zed-docs`
    - It will build the docs and output them in `../zed-docs`
    - Then it will open the docs.
- By default this "dry runs" (doesn't push) but you can pass `-p` to
push the changes.
    - If you add `-c` it will clean out the old docs before running.
    
If you run the script with `p` it will push up the changes, and vercel
will automatically deploy them.

Release Notes:

- N/A
2023-11-20 18:07:37 -05:00
Conrad Irwin 73edcdb601 borrow less 2023-11-20 16:00:47 -07:00
Nate Butler 92559627c5 Make the script a bit more resilient 2023-11-20 17:50:25 -05:00
42dfefd738 WIP
co-authored-by: conrad <conrad@zed.dev>
co-authored-by: Nathan <nathan@zed.dev>
2023-11-20 14:46:01 -08:00
Nate Butler 1c67b5f939 Add more crates 2023-11-20 17:07:14 -05:00
Nate Butler 6732d0d0d9 Create deploy-docs 2023-11-20 16:13:18 -05:00
Marshall Bowers f0c0dd9389 Rename ListEntry to ListItem (#3371)
This PR renames the `ListEntry` component to `ListItem` to better
reflect its intent.

Release Notes:

- N/A
2023-11-20 16:13:06 -05:00
Joseph T. Lyons ccc4ecbf76 Remove comments 2023-11-20 16:04:32 -05:00
Joseph T. Lyons cbea2ebe6c Mark app event as open if we fail to get installation_id
If we find a previous installation_id, then we send `open`. If we don't find a previous installation_id, then we sent as `first open`. If we fail, we mark it as `open` so that we don't accidentally bloat our `first open` stats.
2023-11-20 16:04:15 -05:00
Joseph T. Lyons 70402b6918 Fix zed2 compile error 2023-11-20 16:00:05 -05:00
Joseph T. Lyons 8c8ff42d79 Add app events 2023-11-20 15:51:36 -05:00
Max Brunsfeld cd318772fe More fixes for zed nightly (#3370)
When running `script/bundle` with the new `-2` flag, we needed to adjust
the fat-binary creation step to look for the binary called `Zed2`.

We also fixed a source of intermittent build failures in `script/bundle`
due to running multiple `swift build` processes concurrently for the
`live_kit_client2` crate, building for the two architectures.

Release Notes:

NA
2023-11-20 12:36:25 -08:00
Max BrunsfeldandJulia c72e85c505 Fix error when building live_kit_client2 for two architectures concurrently
Co-authored-by: Julia <julia@zed.dev>
2023-11-20 12:10:35 -08:00
Marshall Bowers a8217ed1dc Rework List to use children (#3369)
This PR reworks the `List` component to use `children` instead of
accepting a `Vec<ListItem>` in its constructor.

This is a step towards making the `List` component more open.

Release Notes:

- N/A
2023-11-20 14:58:31 -05:00
Mikayla 7fcc5808ba fix gpui2 2023-11-20 11:55:27 -08:00
Conrad Irwin 80a6bc31ac WIP 2023-11-20 12:34:08 -07:00
Conrad Irwin 2b5db53b51 Merge branch 'main' into callback-handles 2023-11-20 12:21:42 -07:00
Max BrunsfeldandMikayla 41cd09cc4a Set -e in bump-nightly script
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-11-20 11:01:37 -08:00
Max BrunsfeldandMikayla aba7e5845c Allow bundling in debug mode with both architectures
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-11-20 11:00:12 -08:00
Max BrunsfeldandMikayla 31fd06552f Remove gpui (1) dependencies from zed2
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-11-20 10:46:16 -08:00
Mikayla 9895676841 WIP 2023-11-20 10:34:22 -08:00
Piotr Osiewicz 9d58bf0c75 Fix warnings in tests 2023-11-20 19:25:14 +01:00
Piotr Osiewicz 7629099e79 Merge branch 'main' into search2 2023-11-20 19:23:35 +01:00
Piotr Osiewicz 8da8626397 fixup dismissing of search bar 2023-11-20 19:07:37 +01:00
Conrad Irwin d6aa225b82 Refine element and component traits (#3367)
This PR changes `Element::paint` to move self and introduces a new
`RenderOnce` trait, which renders into an element by moving self.
Elements are required to be `RenderOnce`, and `element_id` is now on
`RenderOnce` so we can get the id without moving self. The `child` and
`children` methods now expect `impl RenderOnce`.

```rust
pub trait Element<V: 'static>: 'static + RenderOnce<V> {
    type State: 'static;

    fn layout(
        &mut self,
        view_state: &mut V,
        element_state: Option<Self::State>,
        cx: &mut ViewContext<V>,
    ) -> (LayoutId, Self::State);

    fn paint(
        self,
        bounds: Bounds<Pixels>,
        view_state: &mut V,
        element_state: &mut Self::State,
        cx: &mut ViewContext<V>,
    );

    fn into_any(self) -> AnyElement<V> {
        AnyElement::new(self)
    }
}

pub trait RenderOnce<V: 'static>: Sized {
    type Element: Element<V> + 'static;

    fn element_id(&self) -> Option<ElementId>;

    fn render_once(self) -> Self::Element;

   // default helpers ...
}
```

To make a type a component, you can add `#[derive(RenderOnce)]`, which
will require your type to implement the `Component` trait:

```rust
pub trait Component<V: 'static>: 'static {
    type Rendered: RenderOnce<V>;

    fn render(self, view: &mut V, cx: &mut ViewContext<V>) -> Self::Rendered;
}
```

I'm satisfied with this being what we open source for elements, aside
from maybe adding a `StatefulComponent` trait that uses element state.
Things finally feel like they slot into a coherent and simple narrative.

Release Notes:

- N/A
2023-11-20 10:48:50 -07:00
Piotr Osiewicz 4c46b416e7 Remove unused import 2023-11-20 18:44:51 +01:00
Piotr Osiewicz e6f40d7133 fixup! Merge branch 'main' into search2 2023-11-20 18:42:15 +01:00
Piotr Osiewicz 9fc3540a43 Merge branch 'main' into search2 2023-11-20 18:37:41 +01:00
Piotr Osiewicz ecfcfa158f fixup! Remove dbg statements 2023-11-20 18:35:39 +01:00
Piotr Osiewicz 115bd5caef Remove dbg statements 2023-11-20 18:31:30 +01:00
Piotr Osiewicz 79e6b0c127 Fix up tests once and for good 2023-11-20 18:24:37 +01:00
Conrad Irwin 3851e7a298 Fix storybook2 2023-11-20 10:16:05 -07:00