Commit Graph
822 Commits
Author SHA1 Message Date
Max Brunsfeld b70c74f690 Fix inconsistent worktree state when renaming entries while scanning 2023-04-13 22:34:34 -07:00
Max Brunsfeld ef57a8e02a Add randomized test for mutating worktree during initial scan 2023-04-13 22:34:03 -07:00
Max Brunsfeld 54e7342c7e Always bump scan_id when refreshing an entry
The scan_id needs to be bumped even if a scan is already in progress,
so that worktree updates can detect that entries have changed. This
means that the worktree's completed_scan_id may increase by more than
one at the end of a scan.
2023-04-13 16:51:11 -07:00
Max Brunsfeld 9bf8ade7b4 Don't process gitignore updates after the initial scan 2023-04-12 18:17:29 -07:00
Max Brunsfeld 36fc0c36e6 Prioritize path refresh requests over gitignore status updates 2023-04-12 18:08:00 -07:00
Max Brunsfeld 42e6ac50ea Restructure background scanner to handle refresh requests even while scanning 2023-04-12 16:29:51 -07:00
Antonio Scandurra 46a76c7d22 Merge pull request #2349 from zed-industries/randomized-tests-operation-script
Restructure randomized integration test to allow editing and replaying a plan, fix discovered bugs
2023-04-12 11:45:47 +02:00
Antonio Scandurra e0c2290be4 Forget buffered operations when resyncing with the host
Previously, we could end up with a situation where the host did not
see an operation but a guest that didn't have that buffer open would. When
such guest would finally open the buffer, they would apply the operation
without however sending it to the host. The guest wouldn't bother resyncing
it because it wasn't part of its open buffers.
2023-04-12 10:39:01 +02:00
Antonio Scandurra c4e9506f0a Re-send worktree if reconnecting while initial scan isn't finished yet
Previously, if the client was disconnected while the initial worktree
state was being sent, it would not see the remaining state after reconnecting.
This was due to `scan_id` and `completed_scan_id` both being initialized to
`0`, so the client would ask for updates since `0` and get nothing.

This commit changes the worktree to initialize `scan_id` to `1` and
`completed_scan_id` to `0`, so that we get the full worktree again on reconnect.
2023-04-11 17:15:43 +02:00
Antonio Scandurra fe75011577 Ensure project is still alive by the time remote LSP request starts 2023-04-11 15:14:32 +02:00
Antonio Scandurra c8bf44e0cd Use LspCommand to handle code actions 2023-04-11 15:12:58 +02:00
Antonio Scandurra da20031383 🔥 2023-04-11 14:53:08 +02:00
Antonio Scandurra 049c4c9eb4 Use LspCommand to handle completions 2023-04-11 14:52:07 +02:00
Antonio Scandurra 4e319f4256 Stop waiting for buffers when releasing a remote project 2023-04-11 10:42:43 +02:00
Max Brunsfeld 0098706f6e Fix leak when project is unshared while LSP handler waits for edits 2023-04-10 17:03:58 -07:00
Max BrunsfeldandAntonio Scandurra eeeb30f56c Preserve ordering between UpdateProject and CreateBufferForPeer messages
Previously, because UpdateProject messages were sent in a separately-
spawned task, they could be sent after CreateBufferForPeer messages that
were intended to be sent after them.

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-04-10 12:54:25 -07:00
Antonio Scandurra cac9fde432 Merge branch 'main' into randomized-tests-operation-script 2023-04-10 08:45:22 +02:00
Antonio Scandurra 1f033488b1 Apply BufferReloaded message to incomplete remote buffers 2023-04-10 08:41:31 +02:00
Antonio Scandurra c3c3416c1f Don't panic if worktree was dropped before sending path changes
In `refresh_entry`, we send a message to the `self.path_changes_tx` channel
to notify the background thread that a path has changed. However, given that
`refresh_entry` uses `spawn_weak`, the worktree could get dropped before sending
the message, which could cause a panic.

This commit changes the code to return an error instead of panicking.
2023-04-10 08:16:08 +02:00
Max BrunsfeldandAntonio Scandurra dfe146d24e Halt UpdateBuffer messages until sync if one errors
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-04-07 17:31:52 -07:00
Max Brunsfeld 4d7e7b58e4 Wait for host to acknowledge buffer updates before sending them to other guests 2023-04-07 16:27:48 -07:00
Nathan Sobo d937660683 Merge MutableAppContext into AppContext
There may have been a good reason for the difference at some point, or I was
still learning Rust. But now it's just &mut AppContext vs &AppContext.
2023-04-06 15:49:03 -06:00
Max BrunsfeldandAntonio Scandurra 1a000f51db Fix handling of redundant buffer creation messages on guests
Check if the buffer already exists *before* overwriting it.
Ignore redundant registrations on remote projects.

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-04-06 12:17:25 -07:00
Max BrunsfeldandAntonio Scandurra ff1fcef1ef Move project assertions into main assertion function
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-04-06 11:38:42 -07:00
Antonio Scandurra e74efb996c Update file on incomplete buffer instead of waiting for it to be opened
This ensures that two successive file updates coming from the host are
not applied in reverse order.
2023-04-06 17:48:44 +02:00
Antonio Scandurra 37e3b58b32 Wait to see guest's buffer version before converting completion anchor 2023-04-06 16:23:10 +02:00
Antonio Scandurra d2d37988c6 Return error if subscribing to an entity that was already subscribed to 2023-04-06 14:42:19 +02:00
Antonio Scandurra 57400dbb98 Forget which buffers were shared when host reconnects
This fixes a bug where the host would momentarily disconnect and the guest
would close and reopen the project. This would cause the host to not observe
the guest closing the project. When the guest tried to open one of the
buffers opened prior to closing the project, the host would not send them the
buffer state because it would still remember that the buffer was shared.

The `shared_buffers` map is now cleared when the host reconnects and will slowly
get re-filled as guests issue `SynchronizeBuffers` requests.
2023-04-06 13:49:09 +02:00
Max Brunsfeld d8119330cf Clear guest's shared buffers if they rejoin project after leaving while host was disconnected 2023-04-05 16:53:36 -07:00
Max Brunsfeld 79b21904d6 Don't skip worktree updates if unknown entries are removed
When rejoining a project, if entries were both created and deleted since
joining the project, the guest will receive those entries ids in as
removed.
2023-04-05 15:36:01 -07:00
Max Brunsfeld 7cd4e07a92 Avoid applying outdated UpdateProject methods after rejoining a room 2023-04-04 21:49:37 -07:00
Max BrunsfeldandNathan Sobo 4d1fffcde4 Avoid applying outdated UpdateProject messages
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2023-04-04 18:34:39 -07:00
Max Brunsfeld 2d21ddd72f Use synchronous locks in FakeFs
This way, the state can be accessed without running the deterministic
executor.
2023-04-03 18:15:07 -07:00
Max Brunsfeld 65960ea16f Fix bug where guest would drop BufferSaved messages while opening the buffer 2023-04-03 16:23:44 -07:00
Nathan Sobo bf6d9cbd81 Wrap AnyWeak handles with their typed counterparts 2023-04-02 15:42:03 -06:00
Mikayla Maki 2ba0046a08 Merge branch 'main' into copilot 2023-03-30 16:57:18 -07:00
Julia efde8aeb63 Allow each language adapter to provide their own code action kinds array 2023-03-30 15:41:54 -04:00
1205cd55ea Add copilot crate
Refactor HTTP and github release downloading into util
Lazily download / upgrade the copilot LSP from Zed

Co-authored-by: Max <max@zed.dev>
Co-Authored-By: Antonio <antonio@zed.dev>
2023-03-28 09:41:59 -07:00
Max Brunsfeld 52e681f0c2 Handle path changes and progress updates from all worker threads during initial scan 2023-03-24 14:35:18 -07:00
Max Brunsfeld 8e00ea4925 Merge branch 'main' into lsp-file-change-notifications 2023-03-24 08:52:43 -07:00
Max Brunsfeld 8a7393b375 🎨 BackgroundScanner::run 2023-03-23 18:05:12 -07:00
Max Brunsfeld cb99df7876 🎨 Don't store path changes statefully on the background scanner 2023-03-23 16:04:47 -07:00
Max Brunsfeld df17888473 Respect LSP servers watch glob patterns 2023-03-23 16:03:07 -07:00
Petros AmoiridisandAntonio Scandurra eb2d122bca Introduce terminal button count
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-22 16:13:58 +02:00
Max Brunsfeld 9efc2a6f5a Remove unnecessary Arc around background scanner's snapshot 2023-03-21 15:47:02 -07:00
Max Brunsfeld be061cfdab Fix error in joining empty paths 2023-03-21 15:41:24 -07:00
Max Brunsfeld f610d0ea51 Allow refreshing worktree entries while the initial scan is in-progress 2023-03-21 15:15:12 -07:00
Max Brunsfeld bc7c6a661a Only mutate background snapshot in the background scanner 2023-03-21 11:26:33 -07:00
Max Brunsfeld 5795c3de6e Restructure communication from BackgroundScanner to LocalWorktree
The worktree no longer pulls the background snapshot from the background scanner.
Instead, the background scanner sends both snapshots to the worktree. Along with
these, it sends the path change sets.

Also, add randomized test coverage for the worktree UpdatedEntries events.
2023-03-21 11:26:13 -07:00
Max Brunsfeld 2fa6c86b1b 🎨 Simplify some worktree methods
* Consolidate local worktree construction into one method
* Simplify remote worktree construction
* Reduce indirection around pulling worktree snapshots from the background
2023-03-21 11:26:13 -07:00