Commit Graph
604 Commits
Author SHA1 Message Date
Conrad Irwin 3e5379526e Fix entity map drop behavior
The entity map needs to be able to distinguish between the case when
the entity_id is waiting to be dropped, and when it is completely gone.

Before 8bc207141, it assumed that entity_ids in dropped_entity_ids could
be re-used. This caused `take_dropped` to error because the slot had
been overwritten. The fix there caused weak handles to allow upgrading
a reference count from 0, which could resurrect items in
`dropped_entity_ids` which caused them to be dropped twice.

We could allow weak items to upgrade from 0, and delete from
dropped_entity_ids, but that seemed more complicated than necessary.
2023-10-31 13:09:35 +00:00
Antonio Scandurra 88875fd006 Zed2 entities (#3189)
Adds an `Entity` trait for abstracting over `View`s and `Model`s, and
implements it for the `subscribe()` and `observe()` APIs.

The last commit also includes a fun experiment I added, using the
`Result` type to return the owned model handles back to the caller in
the case of downcast failure, inspired by the `binary_search*` methods.
2023-10-31 10:11:25 +01:00
Julia db34de6be4 Port zed/src/languages to zed2 2023-10-30 21:52:29 -04:00
Mikayla f5b13071f1 experiment with a way to recover the any entities when downcasting fails 2023-10-30 18:08:38 -07:00
Mikayla 6f1197e00c Change model to downcast with ownership 2023-10-30 18:00:37 -07:00
Mikayla 327a2f9967 Add the entity trait and implement for models, views, subscriptions, and observations 2023-10-30 17:50:21 -07:00
30dffbb409 Introduce a Render trait, make views implement it
Don't pass a render function separately from the view.

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Antonio <as-cii@zed.dev>
2023-10-30 15:19:40 -07:00
Antonio Scandurra 0128079de0 WIP 2023-10-30 20:36:48 +01:00
bc4f8fbf4e Rename other references from "handle" to "model"
Co-Authored-By: Max <max@zed.dev>
Co-Authored-By: Mikayla <mikayla@zed.dev>
2023-10-30 19:54:32 +01:00
Antonio Scandurra 1a54ac0d69 Rename Handle to Model 2023-10-30 19:44:01 +01:00
Antonio Scandurra 25e882d72a Remove randomness from GPUI2 block_with_timeout 2023-10-30 12:10:55 +01:00
Nathan Sobo e27427dce8 Merge branch 'gpui2-docs' into zed2 2023-10-27 17:07:28 -06:00
Nathan Sobo f88ca2e7da Add docs for window.rs, but still incomplete 2023-10-27 22:29:59 +02:00
Nathan Sobo ad7c49e4bb Add doc comments to app.rs 2023-10-27 21:19:48 +02:00
Conrad Irwin 67ecc2fe04 Comment out failing gpui2 test 2023-10-27 11:24:23 +02:00
Conrad Irwin af0c010b4a Remove deadlock from gpui2 pasteboard 2023-10-27 11:14:13 +02:00
Conrad Irwin 5f5234c5da Fix fs2 tests 2023-10-27 10:51:36 +02:00
Conrad Irwin c1904b493b Fix cargo fmt 2023-10-27 10:44:57 +02:00
Nathan Sobo a1c3826858 Add View::update which provides a ViewContext 2023-10-26 19:41:42 +02:00
Conrad Irwin adc426b668 v1 2023-10-26 18:19:57 +02:00
Antonio Scandurra 8e3314e680 WIP 2023-10-26 18:17:45 +02:00
Antonio Scandurra 637cff3ebd WIP 2023-10-26 17:15:19 +02:00
Max Brunsfeld 65045b9c52 Get remaining language2 tests passing 2023-10-26 16:38:50 +02:00
Max BrunsfeldandMarshall Bowers 0eae962abf Represent theme's syntax colors with string keys
Co-authored-by: Marshall Bowers <marshall@zed.dev>
2023-10-26 16:38:50 +02:00
Max BrunsfeldandConrad 8bc2071414 Fix gpui2 bugs
* Compile error for tests that take StdRng
* Dynamic type dowcasting error when emitting events
* Slot error when dropping handles

Co-authored-by: Conrad <conrad@zed.dev>
2023-10-26 15:54:19 +02:00
Marshall Bowers d62c51a4b8 Merge branch 'gpui2-element-renderer' into zed2 2023-10-26 15:23:02 +02:00
Marshall Bowers fccc4ca85c Initialize element before layout 2023-10-26 15:22:48 +02:00
69e5ecc015 Enable client tests
* implement Executor::advance_clock

Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by:  Kyle <kyle@zed.dev>
Co-authored-by:  Joseph <joseph@zed.dev>
2023-10-26 14:44:13 +02:00
Kirill Bulatov 27d2accb51 Fix the formatting 2023-10-26 13:52:04 +02:00
Kirill Bulatov 0a04c5734b Update mouse position during file drag and drop 2023-10-26 13:50:35 +02:00
Max Brunsfeld a4b7e3c9f6 Merge branch 'zed2-hangs' into zed2 2023-10-26 12:48:35 +02:00
065d26f5b2 Get RPC2 tests passing
Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Kyle <kyle@zed.dev>
2023-10-26 12:47:37 +02:00
Nathan Sobo 0285284ae1 Rename IntoAnyElement trait to Component 2023-10-26 12:46:52 +02:00
Nathan Sobo 8ecfea55cd Replace derive Element with derive IntoAnyElement everywhere 2023-10-26 12:38:23 +02:00
06c22206af Add install_cli2
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-Authored-By: Kirill <kirill@zed.dev>
2023-10-26 12:09:54 +02:00
Nathan Sobo db15db45ce WIP 2023-10-26 11:31:47 +02:00
Kirill Bulatov 483ac9491a Start fixing room2 2023-10-26 11:27:12 +02:00
Conrad Irwin 6185c935a6 Fix small bugs in gpui2::test 2023-10-26 11:23:07 +02:00
Nathan Sobo 45a8aea0f0 Make FnOnces that render elements IntoAnyElement 2023-10-26 11:21:42 +02:00
Marshall Bowers 4266ead958 WIP: Trait bounds 2023-10-26 10:46:02 +02:00
Conrad Irwin 5651ef7ca2 Use quit to end tests 2023-10-26 10:40:04 +02:00
Conrad Irwin 51aa0d6a94 Clearer error on importing both gpui and gpui2 2023-10-26 10:39:52 +02:00
Marshall Bowers 8b972f6d8e WIP: Fix compilation of gpui2 2023-10-26 09:51:33 +02:00
Marshall Bowers 965bfd8439 WIP: Pass in V to Element 2023-10-26 09:45:26 +02:00
Antonio Scandurra c5763cdb99 Fix errors in passing TestAppContext in async gpui2 tests 2023-10-25 21:08:00 +02:00
43d230cb2d Introduce a gpui2::test macro
Co-Authored-By: Conrad Irwin <conrad.irwin@gmail.com>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Kyle <kyle@zed.dev>
2023-10-25 21:08:00 +02:00
Marshall Bowers 7ec9cc08c7 Fix z-index targeting for drag and drop 2023-10-25 20:49:40 +02:00
Marshall Bowers 5355007719 Clean up some warnings 2023-10-25 20:40:50 +02:00
Antonio Scandurra 5ba04dce2b Assert handles are passed to the right contexts 2023-10-25 19:46:13 +02:00
412c0ff7dc Add fs2
Co-Authored-By: Max <max@zed.dev>
Co-Authored-By: Conrad <conrad.irwin@gmail.com>
Co-Authored-By: Kyle <kyle@zed.dev>
2023-10-25 19:17:50 +02:00