This PR adds a `map` method to the `Component` trait.
`map` is a fully-generalized form of `when`, as `when` can be expressed
in terms of `map`:
```rs
div().map(|this| if condition { then(this) } else { this })
```
This allows us to take advantage of Rust's pattern matching when
building up conditions:
```rs
// Before
div()
.when(self.current_side == PanelSide::Left, |this| this.border_r())
.when(self.current_side == PanelSide::Right, |this| {
this.border_l()
})
.when(self.current_side == PanelSide::Bottom, |this| {
this.border_b().w_full().h(current_size)
})
// After
div()
.map(|this| match self.current_side {
PanelSide::Left => this.border_r(),
PanelSide::Right => this.border_l(),
PanelSide::Bottom => this.border_b().w_full().h(current_size),
})
```
Release Notes:
- N/A
authenticate with completion provider on new inline assists
Release Notes:
- Fixed bug which lead the inline assist functionality to never
authenticate
This pull request removes more `Send` bounds from GPUI2 after #3206 and
simplifies some internals. Specifically:
- The `Reference` enum was removed, as we always capture mutable
references anyway.
- A few GATs from `Context` and `VisualContext` were removed, as they're
unnecessary now that `MainThread` isn't a thing.
- View rendering was greatly simplified (we were able to remove
`EraseViewState` and `ViewObject`)
Release Notes:
- N/A
The potential for deadlock and other complexity ended up convincing us
that the benefits of making the app state accessible from any thread
were not worth their cost. We probably could have gone back to the old
executors, but we decided to fix forward and continue to get the
benefits of the new dispatcher.
This PR adjusts the representations of `ColorScale`s to allow us to
remove an unsafe `From` impl when converting from the statically-defined
representation of the scale.
Release Notes:
- N/A