Commit Graph

284 Commits

Author SHA1 Message Date
Antonio Scandurra
14d26eeedc Move several buffer-related messages to the background 2022-03-03 12:18:19 +01:00
Antonio Scandurra
1c14168f38 Ensure no two worktrees can point to the same root path
This could happen because there was a pause between creating the worktree
and adding it to the list of tracked local worktrees, and so we might end
up adding the same worktree twice when calling `create_local_worktree` in
rapid succession.
2022-03-03 10:54:52 +01:00
Antonio Scandurra
d171d8ccc4 Change the definition of check_invariants
- On the host, ensure that only one worktree can exist for a given absolute
path. Asserting about buffers was cool but I think should be tackled in the
context of leaning more on entry ids for collaboration (vs. buffer ids).
- On the guest, ensure that all the opened buffers don't contain deferred
operations.
2022-03-03 10:51:37 +01:00
Antonio Scandurra
53327e2bf0 Ensure worktree is registered/shared synchronously 2022-03-03 10:10:53 +01:00
Max Brunsfeld
d4ae38fcee Check projects' buffers have unique absolute paths in random collab test 2022-03-02 14:38:16 -08:00
Max Brunsfeld
ca920e1552 Rename strong_worktrees -> visible_worktrees 2022-03-02 14:38:16 -08:00
Antonio Scandurra
68cfce1fb8 Rename weak to visible
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-02 14:38:16 -08:00
Antonio Scandurra
07120d47f9 Convert weak worktree handles into strong handles when sharing
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-02 14:38:16 -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
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
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
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
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
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
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
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
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
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
Nathan Sobo
dd6f8d20a3 Remove carriage returns 2022-02-27 07:47:46 -07:00
Nathan Sobo
e822c6a64e Handle project-wide search on guests
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 15:09:47 -07:00
Antonio Scandurra
88bfe5acb0 Allow splitting project find and maintain the searches in sync 2022-02-25 16:20:02 +01:00
Antonio Scandurra
29e035a70d Don't report a buffer when it doesn't contain any matches 2022-02-25 15:40:19 +01:00
Antonio Scandurra
2147db9b41 Open searched buffers in parallel 2022-02-25 12:29:50 +01:00
Antonio Scandurra
561123d6de Avoid extra smol::channel when iterating through snapshot paths 2022-02-25 11:49:33 +01:00
Antonio Scandurra
6a0cca7178 Add a fast path for when the search query is empty 2022-02-25 10:58:45 +01:00
Antonio Scandurra
0bf944e038 Use Project::search in ProjectFind and show search results 2022-02-25 10:32:45 +01:00
Antonio Scandurra
6d9b003634 WIP: Start sketching in ProjectFindView
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-24 19:07:00 +01:00
Antonio Scandurra
e83d1fc9fc Start on a regex implementation of SearchQuery 2022-02-24 16:33:31 +01:00
Antonio Scandurra
76cc9b347e Extract a search module 2022-02-24 15:55:13 +01:00
Antonio Scandurra
6a323ce2dd Implement a basic project-wide search using Aho-Corasick 2022-02-24 15:33:56 +01:00
Antonio Scandurra
26f7f4f5b2 WIP: Remove ripgrep and start matching query for paths ourselves 2022-02-24 12:33:28 +01:00
Antonio Scandurra
119bfaa99f WIP 2022-02-24 11:57:53 +01:00
Antonio Scandurra
fed6f708c0 Start on project-wide find 2022-02-24 11:57:53 +01:00
Antonio Scandurra
8fa23c702c Store ops if buffer handle can't be upgraded and buffer requests are in-flight 2022-02-24 09:32:31 +01:00
Max Brunsfeld
a6613d5345 Store operations for unknown buffers when there are outstanding buffer RPC requests 2022-02-23 20:35:05 -08:00
Max Brunsfeld
6060077444 Remove unused pending_updates field from RemoteWorktree 2022-02-23 16:59:39 -08:00
Max Brunsfeld
170487a528 Fix race conditions with LSP requests that return buffers
* Avoid panic when registering a buffer that was previously open,
  and whose weak handle was still present in the open_buffers map.
* Avoid releasing any buffers while a request is outstanding which
  could return a reference to a buffer.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-23 15:26:01 -08:00
Nathan Sobo
17c9aa1819 Remove ShareWorktree message
Instead, create an empty worktree on guests when a worktree is first *registered*, then update it via an initial UpdateWorktree message.

This prevents the host from referencing a worktree in definition RPC responses that hasn't yet been observed by the guest. We could have waited until the entire worktree was shared, but this could take a long time, so instead we create an empty one on guests and proceed from there.

We still have randomized test failures as of this commit:

SEED=9519 MAX_PEERS=2 ITERATIONS=10000 OPERATIONS=7 ct -p zed-server test_random_collaboration

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-23 11:56:09 -07:00
Antonio Scandurra
d1b4384f80 WIP 2022-02-23 19:04:22 +01:00
Antonio Scandurra
8440644dc9 Remove update_id from worktree update messages
We don't need this anymore because worktree updates are foreground
messages.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-23 18:35:25 +01:00
Antonio Scandurra
f3c6320eeb Move document highlights RPC message to the background 2022-02-23 16:16:02 +01:00
Antonio Scandurra
9e173564e9 Pass an AsyncAppContext to fake language server request handlers 2022-02-23 16:14:36 +01:00
Max Brunsfeld
e140f70e3c Show document highlights from the language server when moving the cursor 2022-02-22 17:16:31 -08:00
Max Brunsfeld
25d45378e4 Implement find-all-references
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-22 14:27:16 -08:00
Max Brunsfeld
5d2201c4ca Add integration test for project symbols
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-22 12:44:17 -08:00
Max Brunsfeld
669fe775df Normalize paths passed to the FakeFs
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-22 12:43:56 -08:00
Max Brunsfeld
64098247cb Allow languages to be registered at any time
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-22 10:35:20 -08:00
Antonio Scandurra
d7db3791d5 Show worktree root name for symbol when there are multiple worktrees
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-22 18:57:41 +01:00