Commit Graph
111 Commits
Author SHA1 Message Date
Antonio ScandurraandJulia Risley 09db455db2 Port semantic_index to gpui2
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-12-05 15:38:36 +01:00
Piotr OsiewiczandAntonio b5924d6b11 Add simulate_window_resize.
Fixes up tests for movement in editor/scrolling.

Co-authored-by: Antonio <antonio@zed.dev>
2023-12-04 17:27:48 +01:00
Piotr OsiewiczandAntonio 2108ddf621 Defer activating Subscriptions that are invoked as a part of an effect.
Fixes test test_edit_events.

Co-authored-by: Antonio <antonio@zed.dev>
2023-12-04 16:17:33 +01:00
Piotr OsiewiczandAntonio b9a917f42a Fix up condition not checking the condition at the start.
Co-authored-by: Antonio <antonio@zed.dev>
2023-12-04 15:31:35 +01:00
Piotr Osiewicz 24b08921fe Revert "fix display map tests"
This reverts commit 0f7fc8c1a0.
2023-12-04 15:22:29 +01:00
Piotr Osiewicz 0f7fc8c1a0 fix display map tests
These tests failed due to an indefinite hang in buffer.condition in the following code:
\`\`\`rust
    let buffer = cx
        .add_model(|cx| Buffer::new(0, cx.model_id() as u64, text).with_language(language, cx));
    buffer.condition(cx, |buf, _| !buf.is_parsing()).await;
`\`\`
In both gpui1 and gpui2 \`.with_language\` spawns a task that notifies the context once it's done. The \`condition\` waits for notifications to be raised. The gist of the problem was that in gpui2, the spawned task was scheduled straight away, so we never really saw the notification with \`condition\`, causing us to wait indefinitely. This is probably a difference in test between schedulers in gpui1 and gpui2, but I kind of sidestepped the issue by spawning a condition before firing off a parsing task with \`set_language\`.
2023-12-04 13:14:03 +01:00
Max Brunsfeld cb11c1282c Re-introduce active path tracking in workspace 2023-11-30 14:58:14 -08:00
Max Brunsfeld a003a91212 Restore auto-save on focus change, re-enable workspace tests 2023-11-30 14:45:27 -08:00
Max BrunsfeldandConrad 233aac5573 Make DismissEvent a unit struct
Co-authored-by: Conrad <conrad@zed.dev>
2023-11-29 09:42:54 -08:00
Conrad Irwin 039c933d8e gpui2: Notifications 2023-11-26 22:28:53 -07:00
Piotr Osiewicz 54a3b56935 Merge remote-tracking branch 'origin/callback-handles' into search2 2023-11-21 00:40:20 +01:00
Conrad Irwin d0dd44faad Merge branch 'main' into callback-handles 2023-11-20 12:21:42 -07:00
Piotr Osiewicz d60855b06d Merge branch 'main' into search2 2023-11-20 19:23:35 +01:00
Piotr Osiewicz 07cc5904f8 Merge branch 'main' into search2 2023-11-20 18:37:41 +01:00
Conrad Irwin 0798cfd58c Merge branch 'main' into derive-element-redux 2023-11-20 09:15:38 -07:00
Mikayla 88024ca7c9 Remove V parameter on elements 2023-11-19 18:32:31 -08:00
Nathan Sobo adc355a1e6 Element refinement passing on ui2 2023-11-18 20:05:47 -07:00
Nathan Sobo 2515bbf990 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
Julia 189ddf9380 Merge branch 'main' into unborked-git-zed2-diagnostics-view 2023-11-17 16:43:29 -05:00
Julia 3655a96e54 Merge branch 'main' into unborked-git-zed2-diagnostics-view 2023-11-17 16:32:35 -05:00
Julia c6d22af416 Get diagnostic2 tests building and running 2023-11-17 16:32:35 -05:00
Mikayla 149b9d1aa6 Merge branch 'main' into managed-view-adjustment 2023-11-17 12:40:44 -08:00
Conrad Irwin 624bd0a05a Collab ui2 (#3357)
* Clickable context menus & movable panels – what will they think of
next?!

Release Notes:

- N/A
2023-11-17 13:33:18 -07:00
Conrad Irwin 9d742b90c3 Allow you to click on a context menu item 2023-11-17 11:57:51 -07:00
Mikayla 17d53d0e38 Rename again, add fun cx APIs using new traits 2023-11-17 10:06:41 -08:00
Piotr Osiewicz eb9959a0cf gpui: notifications now takes an entity instead of a model 2023-11-17 17:23:05 +01:00
Mikayla 9a3cd073c7 Restore a bunch of random workspace stuff 2023-11-16 23:05:28 -08:00
Max Brunsfeld e67c44a562 Fix file-reloading race condition (#3348)
### Summary

This PR fixes a bug that @as-cii and @osiewicz saw when the on-disk
contents of files changed due to running `git checkout` at the command
line. It caused a buffer's contents to diverge from the file's on disk
contents, but the buffer to show an *unmodified* status.

I've also introduced new APIs on gpui's deterministic executor, which
make it possible to write a test that reliably triggered the bug.

### Details

The bug is triggered by the following sequence of events:
1. A buffer's file changes on disk while the buffer is *unmodified*
2. Zed reloads the new content of the file
3. Before updating the buffer itself, Zed computes a *diff* between the
buffer's current contents, and the newly-loaded contents
4. While this diff is being computed, one of two things happens:
     1. the buffer changes on-disk *again*.
2. the user edits the buffer, but undoes the edit, so that the buffer
returns to an unmodified state

The bug itself was caused by a few things:
* The buffer diffing algorithm is pretty slow, because we perform a
character-wise diff
* We previously allowed multiple reload tasks to run concurrently
* When discarding an out-of-date diff, we failed to update parts of the
buffer's state (`saved_fingerprint`) which allow us to recognize that
the buffer's content differs from the file.

It was also difficult to reproduce the problem in tests, because under
deterministic execution, because it was extremely unlikely for other
tasks to make progress *after* a file had been reloaded, but *before*
the disk task has resolved. To help with testing, I introduced a pair of
executor APIs:

`spawn_labeled`, - for spawning a background task with a given *label*
`deprioritize_task` - for forcing tasks with a given label to run
*after* all other concurrent tasks.

I also made the `Model::next_event` test helper method more useful, in
that it no longer runs *until* parked in order to wait for the next
event to occur. It just steps the executor one poll at a time until the
model emits an event.

Release Notes:

- Fixed a bug that caused buffers to report incorrect modified/conflict
status when their buffers changed on disk multiple times in rapid
succession.
2023-11-16 20:19:16 -08:00
Max Brunsfeld 32979f3aca Rename deprioritize_task -> deprioritize
It applies to a family of tasks, not a task.
2023-11-16 20:03:18 -08:00
Max BrunsfeldandNathan Sobo f3b6719c76 Rename both PlatformDispatcher::poll and Executor::run_step to 'tick'
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2023-11-16 19:58:26 -08:00
Max Brunsfeld f9650b3111 Don't run until all the way until parked when waiting for a model's next event 2023-11-16 15:54:00 -08:00
Mikayla 9da0b78ead Merge branch 'main' into tabs-n-splits 2023-11-15 23:41:25 -08:00
Mikayla 78cea69172 Add focusable view and restore workspace deserialization. Partially restore split and tab functions 2023-11-15 16:36:43 -08:00
Conrad Irwin 0a51784dd0 Leaky, but better, test abstraction 2023-11-15 14:01:10 -07:00
Conrad Irwin cebc8428c8 FileFinder tests 2023-11-15 13:16:28 -07:00
Conrad Irwin 91b54b352b Add command palette tests and simulate_keystrokes 2023-11-14 23:22:51 -07:00
Mikayla Maki df64a3c701 Not working yet file-finder2 (#3321)
Porting file_finder

Release Notes:

- N/A
2023-11-14 15:22:59 -08:00
Max Brunsfeld ca63a99736 Enable tests in project panel 2 (#3325) 2023-11-14 15:02:51 -08:00
Max Brunsfeld 860959fe13 Implement simulated prompts in TestPlatform 2023-11-14 14:56:50 -08:00
Mikayla 6b25841e2a WIP 2023-11-14 14:48:34 -08:00
Conrad Irwin 3b01a032ba In the middle of stuff 2023-11-14 14:38:23 -07:00
Max Brunsfeld 123faed5b0 Re-enable all project panel tests
Some are still failing.
2023-11-14 12:45:46 -08:00
Mikayla 3419aaf17e Fix several shutdown related bugs 2023-11-14 11:42:58 -08:00
Mikaylaandconrad a4e9fea133 WIP
co-authored-by: conrad <conrad.irwin@zed.dev>
2023-11-13 15:53:04 -08:00
Mikayla 0e3fd92bd0 Get editor tests compiling 2023-11-13 12:10:14 -08:00
Mikayla 656eb9d455 WIP 2023-11-09 00:18:00 -08:00
Mikayla 43eb7f28d1 checkpoint 2023-11-08 23:16:04 -08:00
Mikayla 7a7ef1025d Add Context::read_window, WindowHandle::root, and change ViewContext.view() to return a reference 2023-11-08 22:11:19 -08:00
Mikayla 2c67cc80ba Merge branch 'main' into event-emitter 2023-11-08 20:10:38 -08:00
Mikayla 26fc36ee0e First pass at allowing multiple event types to be emitted by an entity 2023-11-08 16:34:38 -08:00