Commit Graph
14728 Commits
Author SHA1 Message Date
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
Conrad Irwin 2dd5bbe448 fmt 2023-11-20 10:05:57 -07:00
Conrad Irwin 1422b55f2d Fix more import errors 2023-11-20 10:01:21 -07:00
Conrad Irwin e6c59f6448 shhhh 2023-11-20 10:00:37 -07:00
Conrad Irwin 7147bff519 Merge followup mess 2023-11-20 09:58:05 -07:00
Conrad Irwin 16cca67638 Merge branch 'main' into derive-element-redux 2023-11-20 09:15:38 -07:00
Joseph T. Lyons 9879e6bdc5 Add timestamp delta to telemetry events (#3365)
- [X] assistant_events
- [X] call_events
- [X] copilot_events
- [X] cpu_events
- [X] download_events
- [X] editor_events
- [X] memory_events
- [X] page_events
- [X] panic_events
---
- [X] For each of the previous tables:
    - [X] backup events to comp
    - [X] make new table (changing any time fields to be datetime64)
    - [X] copy data
    - [X] rename old table
    - [X] rename new table
---
- [ ] Delete all old tables once (going to hold off on this for some
time - want to make sure things are working correctly)
    - [X] we see new data coming in on new tables
    - [X] old times truncate correctly
    - [X] new times show millisecond values
---
- [X] check dashboards to make sure queries didn't get broken from
changing time data type
    - [X] Fix broken charts
- [X] monitor vercel for runtime errors

---

- [X] zed.dev changes
- [X] chrono changes to panicked_on
    - [X] Make sure new panics are good
- [X] remove commented out code and dbg code
- [X] triple check that both crate versions have the changes
- [X] make sure all event function calls use the same original arguments
- [X] Finish testing version 2

Release Notes:

- N/A
2023-11-20 09:27:18 -05:00
Joseph T. Lyons ba15159963 Activate telemetry in zed2 2023-11-20 09:08:07 -05:00
Piotr Osiewicz 1fc826f7ba Circumvent part of the tests 2023-11-20 13:43:56 +01:00
Joseph T. Lyons 01fbc5e346 Remove unused imports 2023-11-19 22:09:14 -05:00
Joseph T. Lyons e22781b426 Fix data types 2023-11-19 22:03:55 -05:00
Joseph T. Lyons 2c70da8784 Restore commented-out code 2023-11-19 22:00:01 -05:00
Joseph T. Lyons 4eb07e37ea Remoe dbg!()s 2023-11-19 21:55:19 -05:00
Joseph T. Lyons e000d61ca8 Add timestamp delta to telemetry events 2023-11-19 21:52:28 -05:00
Conrad Irwin fd4f3558b0 Focus workspace on launch (#3364)
Fixes action dispatch when no focus is there.

Release Notes:

- N/A
2023-11-19 19:38:41 -07:00
Conrad Irwin feec6ba26a Fix text wrapping when a child of a v_stack() (#3362)
Previously text that was rendered in a flex-column would reserve the
correct
amount of space during layout, and then paint itself incorrectly.

Release Notes:

- N/A
2023-11-19 11:37:31 -07:00
Piotr Osiewicz 30fef20208 ui2: Do not enable 'stories' feature by default. (#3363)
This cuts down LLVM IR size from 3 million lines to 700k in debug build.
This then leads to ~3s compile time in debug build (without incremental
on ui itself), as opposed to 10.5s on main.

Release Notes:

- N/A
2023-11-19 12:11:42 +01:00
Piotr Osiewicz 6e30ec1f17 Move binding function back into keybinding module 2023-11-19 11:54:46 +01:00
Piotr Osiewicz 5122913349 ui2: Do not enable 'stories' feature by default.
This cuts down LLVM IR size from 3 million lines to 700k in debug build.
This then leads to ~3s compile time in debug build (without incremental on ui itself), as opposed to 10.5s on main.
2023-11-19 11:44:33 +01:00
Conrad Irwin 4d83918d39 delint 2023-11-18 22:20:50 -07:00
Conrad Irwin 4441c34d35 Add some test cases 2023-11-18 22:16:28 -07:00
Nathan Sobo 42badd5d25 Clean compile with redesigned element traits 2023-11-18 21:51:47 -07:00
Conrad Irwin 6f905fce7f Fix wrapping when parent has a max_width
(Also avoid re-wrapping text we already wrapped)
2023-11-18 21:31:16 -07:00
Conrad Irwin a7c153f13e Update Taffy to latest main 2023-11-18 21:30:33 -07:00
Conrad Irwin 8bbe12e3aa Fix text wrapping when a child of a v_stack() 2023-11-18 20:35:22 -07:00
Nathan Sobo 346aa2f30f WIP 2023-11-18 20:22:43 -07:00
Nathan Sobo d2d1f1a1ff Element refinement passing on ui2 2023-11-18 20:05:47 -07:00
Mikayla Maki 2a9943ec14 Revert changes 2023-11-18 16:37:34 -08:00
Mikayla Maki 5385ce9540 Update bundle 2023-11-18 13:06:23 -08:00
Mikayla Maki 7bf4de3275 Update bundle 2023-11-18 11:50:54 -08:00
Mikayla Maki 31c4f1a83c Fix more bundling errors (#3361)
Release Notes:

- N/A
2023-11-18 10:59:35 -08:00
Mikayla 1d22898daa please work 2023-11-18 10:46:35 -08:00
Mikayla Maki cc0acf2554 N/t6 (#3360)
[[PR Description]]

- Fix broken pane group spacing
- Work on diagnostics styling (still wip)

Release Notes:

- N/A
2023-11-17 23:29:18 -08:00
Nathan Sobo 3905cb6c61 WIP: Lots of errors, starting on resurrecting derive Element 2023-11-18 00:27:40 -07:00
Mikayla 3692394f49 Remove unused imports 2023-11-17 23:14:14 -08:00
Nate Butler 37908d2d23 Remove flex_1 from bottom dock to fix pane group spacing 2023-11-18 02:06:51 -05:00
Nathan Sobo 43f3ddf86a WIP: Work toward eliminating Component trait
This refactor enhances the overall design by promoting reusable and composable UI component structures within the Zed project codebase.
2023-11-18 00:03:23 -07:00
Nathan Sobo c2e152f730 Move self in Element::paint
Remove mutable state borrows in favor of state ownership in render processes to streamline element rendering.
2023-11-17 23:32:55 -07:00
Mikayla 5d1949cfe9 Testing the auto-updater 2023-11-17 22:17:42 -08:00
Mikayla Maki 6108fe2c2e Add nightly release channel for zed2 (#3355)
Release Notes:

- N/A
2023-11-17 22:12:18 -08:00
Nate Butler 61027a4183 Use muted color for fold indicators 2023-11-18 01:02:40 -05:00