Commit Graph

3060 Commits

Author SHA1 Message Date
Max Brunsfeld
0e6686916c Remove stray printing in db tests 2022-03-01 12:10:35 -08:00
Max Brunsfeld
43f856c568 Make integration tests depend only on a few core crates, not all of zed 2022-03-01 12:09:51 -08:00
Max Brunsfeld
2b64e8d4a2 Fix failure in test_unshare_project due to dropping handle outside of an update block
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 10:50:58 -08:00
Antonio Scandurra
efe7f61128 Use simulate_random_delay when polling snapshot only in tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-01 19:17:38 +01:00
Antonio Scandurra
a25f21df39 Remove debug_elements_callbacks from App
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-01 19:16:58 +01:00
Antonio Scandurra
bc9c034baa Fix Presenter leak when removing windows 2022-03-01 18:50:05 +01:00
Antonio Scandurra
c661ff251d Revert "Use async_broadcast to emit fake FS events"
This reverts commit 4cfd345f9d, because
having a bounded broadcast introduces the possibility of waiting forever
when there isn't yet a receiver processing those events.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 17:14:40 +01:00
Antonio Scandurra
992328a6ee Forbid parking in project_panel::tests::test_visible_list
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 17:14:18 +01:00
Antonio Scandurra
0bb7189842 Use a weak handle to poll local worktree snapshot
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 17:08:10 +01:00
Antonio Scandurra
83a3402235 Make TestAppContext and its dependencies available only in tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 17:01:52 +01:00
Antonio Scandurra
0d6f6bf5bb Detect when view handles are leaked
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 16:11:12 +01:00
Antonio Scandurra
aa03ebce0e Enable leak backtraces by setting LEAK_BACKTRACE=1
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 16:00:40 +01:00
Antonio Scandurra
4cfd345f9d Use async_broadcast to emit fake FS events
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 15:48:15 +01:00
Antonio Scandurra
3e9dbe10d6 Capture a weak reference to the Project in fake LSP 2022-03-01 13:34:03 +01:00
Antonio Scandurra
8d078ed4e2 Don't block when emitting fs events
Blocking could happen while processing events, which would cause the
background scanner to never make any further progress.
2022-03-01 13:08:50 +01:00
Antonio Scandurra
ce59e57e6d Remove project from host connection when unregistering it 2022-03-01 12:18:55 +01:00
Antonio Scandurra
466db69780 Pass a reference to TestAppContext in tests
This allows us to drop the context *after* we ran all futures to
completion and that's crucial otherwise we'll never drop entities
and/or flush effects.
2022-03-01 12:01:02 +01:00
Antonio Scandurra
8390f04e7d Allow capturing references in the future passed to Deterministic::run 2022-03-01 11:59:58 +01:00
Antonio Scandurra
7ce6f23ed4 Remove all windows on dropping TestAppContext
This allows us to remove the dropped entities and flush effects as
necessary.
2022-03-01 10:55:12 +01:00
Antonio Scandurra
10a872a370 Avoid reference cycle between Client and its models 2022-03-01 10:55:05 +01:00
Max Brunsfeld
471ecae82c WIP - include dhat for memory profiling tests 2022-02-28 22:52:21 -08:00
Max Brunsfeld
3b7cfad718 Try clearing Client's state at the ends of integration tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-28 22:52:21 -08:00
Max Brunsfeld
02ae2d8a4f Hold client weakly in UserStore
This avoids a reference cycle that is causing some tests
to fail due to leaked handles at the moment. There may be
a better way to fix this though.
2022-02-28 22:47:50 -08:00
Max Brunsfeld
1faaa91e52 Avoid retaining executor in the FakeFs
This probably isn't the *root* cause of why an executor is leaked,
but by cutting off this cyclic references, it may make it a bit easier
to track down leaks of an executor.
2022-02-28 22:40:04 -08:00
Max Brunsfeld
3788efeadf Clean up guest connection states correctly when a collaborator disconnects
This bug was caught by running the executor until parked after tests.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-28 22:21:32 -08:00
Max Brunsfeld
c09921e790 Clear the executor at the end of a test by running until it is parked 2022-02-28 22:20:03 -08:00
Max Brunsfeld
426e0e3d4f Flush effects when dropping a TestAppContext
This way, at the end of a test, dropped entities will be removed, and will drop
the handles that they hold.
2022-02-28 22:17:20 -08:00
Max Brunsfeld
7d53e37672 Start work on detecting leaked handles in tests
For now, just track models. Tests fail because we don't
yet clear the app contexts at the right time.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-28 22:02:43 -08:00
Max Brunsfeld
d1d324e42b Never close buffers when sharing
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-28 11:36:43 -08:00
Antonio Scandurra
2111ec04c8 Make SearchProject a Foreground message
However, the randomized integration test is still failing:

```
ITERATIONS=100000 SEED=3027 OPERATIONS=200 cargo test --release test_random --package=zed-server -- --nocapture
```

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-28 16:19:34 +01:00
Antonio Scandurra
400a2fce58 Don't use a bounded channel for signaling that buffers have been opened
Blocking the sender could halt deserialization for no reason if nobody
is consuming the notifications.
2022-02-28 15:26:10 +01:00
Antonio Scandurra
1313ca8415 Don't delete buffer state when calling get_open_buffer
...as we might be in the process of completing a request that could
open a buffer. This was causing a failure in the randomized integration
test.
2022-02-28 14:27:31 +01:00
Antonio Scandurra
5f7a759870 Add project-wide search to randomized integration test 2022-02-28 14:22:31 +01:00
Antonio Scandurra
abdfdcdabf Include buffer's deferred ops when computing has_buffered_operations 2022-02-28 14:22:24 +01:00
Antonio Scandurra
720056d0db Add unit test for project search 2022-02-28 11:10:22 +01:00
Antonio Scandurra
ed89475cf6 Extract a common match_index_for_direction and active_match_index 2022-02-28 10:34:11 +01:00
Nathan Sobo
8eba96424e Fix warning 2022-02-27 18:17:15 -07:00
Nathan Sobo
cb230ad574 Re-activate the most recently-activated project search on cmd-shift-F
This commits adds the beginnings of an application state facility as a non-static place to store the most recently-activated search for each project.

I also store workspace items by descending order of their entity id so that we always fetch the newest item of a given type when calling `Workspace::item_of_type`.
2022-02-27 18:07:46 -07:00
Nathan Sobo
1ddae2adfd Focus the project find results editor on a tab in the query editor 2022-02-27 16:15:06 -07:00
Nathan Sobo
71241b1fb8 Add capture phase for action dispatch
Just like the DOM, we now bubble events down the tree during a capture phase before bubbling them back up.
2022-02-27 16:14:40 -07:00
Nathan Sobo
7d119dcd54 Select first match when results are ready 2022-02-27 14:24:06 -07:00
Nathan Sobo
7831979be0 Fix warning 2022-02-27 14:21:28 -07:00
Nathan Sobo
64d22925c2 Implement navigation between project search matches 2022-02-27 14:18:04 -07:00
Nathan Sobo
7ef98fb935 Make versions oldest_selection and newest_selection that don't require snapshots
I thought I needed this but actually didn't, but I still kinda think it's a good change for the public interface of Editor.
2022-02-27 13:02:09 -07:00
Nathan Sobo
19b5de2181 Introduce ProjectSearchView constructor
We had some duplication when cloning on split, so this is to unify that before we add any more complexity to construction.
2022-02-27 09:49:16 -07:00
Nathan Sobo
dabb17a2ef Clone editor's searchable state on split 2022-02-27 09:48:46 -07:00
Nathan Sobo
136699e7bd Add log dependency in search crate 2022-02-27 09:25:40 -07:00
Nathan Sobo
c7338ebe88 💄 2022-02-27 09:25:27 -07:00
Nathan Sobo
039765b698 Limit project search tab label to 24 characters
I'd love to fade the text out, but for now I just append an ellipsis.
2022-02-27 08:27:02 -07:00
Nathan Sobo
ec317159d7 Rename "find" to "search"
Search is both a verb and a noun, which makes it more natural to use in situations where we need to name a thing rather than a process.
2022-02-27 08:15:38 -07:00