Commit Graph
619 Commits
Author SHA1 Message Date
Antonio Scandurra 59fe0549cc Replace paths_by_id with an entries_by_id sum tree 2021-07-06 12:41:31 +02:00
Antonio Scandurra 3ce2bea63a Unify maintenance of open buffers into Worktree::poll_snapshot 2021-07-06 10:38:39 +02:00
Max Brunsfeld 58eefcd331 Add ModelHandle::spawn_weak, fix worktree leak from spawn call 2021-07-05 17:55:52 -07:00
Max BrunsfeldandNathan Sobo 65e4e78cd7 Add unit test for worktree update messages, fix minor issues
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-05 17:55:48 -07:00
Nathan SoboandMax Brunsfeld 73db910a95 Process remote worktree updates in the background
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-05 14:20:53 -06:00
Nathan SoboandMax Brunsfeld 036dcd50fd Start on applying remote worktree updates in the background
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-05 13:44:42 -06:00
Antonio Scandurra 53adaa77c1 Propagate file system changes to remote worktrees 2021-07-05 17:54:48 +02:00
Antonio Scandurra 2a779d3529 Rename {Add,Remove}Guest to {Add,Remove}Peer 2021-07-05 10:24:39 +02:00
Antonio Scandurra 61222b4fe5 Expose Client::disconnect to force disconnection 2021-07-05 10:18:12 +02:00
Max Brunsfeld 899b9cd5ad Avoid deadlocks on rpc state by switching to an RwLock 2021-07-02 15:55:16 -07:00
Max Brunsfeld a7f812e059 Avoid circular model update in save_buffer handler 2021-07-02 15:53:45 -07:00
Max Brunsfeld 86b9ab4505 Construct remote worktree snapshots in the background 2021-07-02 15:22:58 -07:00
Antonio Scandurra 569a4a1e2d WIP: Save remote buffers 2021-07-02 17:02:17 +02:00
Antonio Scandurra 7ae1d9e997 Send also the currently active selection sets when serializing a buffer 2021-07-02 11:29:36 +02:00
Max Brunsfeld 9d51fe88e9 Serialize RPC sends and responses using a channel 2021-07-01 22:02:27 -07:00
Max BrunsfeldandNathan Sobo 42f7867f6e Avoid spurious error logging when host edits buffers not open by guests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-01 11:23:51 -07:00
Antonio ScandurraandNathan Sobo e95936c624 Fix memory leak of Editor due to blinking cursors
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-01 15:57:17 +02:00
Antonio Scandurra da7bd8439b Report SelectionSet deletion operations correctly 2021-07-01 12:54:16 +02:00
Antonio Scandurra c881c7f30f Start on rendering remote selections 2021-07-01 11:21:43 +02:00
Antonio Scandurra e07065265d Expose Worktree::{peers,replica_id} 2021-07-01 09:36:09 +02:00
Antonio Scandurra ed9036f3fc Send a CloseWorktree message when a shared Worktree is dropped 2021-06-30 17:00:29 +02:00
Antonio Scandurra 1d53d43d6f Store online peers when joining a worktree 2021-06-30 15:07:33 +02:00
Antonio Scandurra 7704291432 Maintain a set of peers as they join and leave the worktree 2021-06-30 13:22:22 +02:00
Antonio Scandurra ab089b6575 Avoid logging errors in RPC message handlers
The `on_message` helper already logs when an error occurs.
2021-06-30 12:05:58 +02:00
Antonio Scandurra 8e5e354bd8 💄 2021-06-30 12:00:13 +02:00
Antonio Scandurra 3c8aa0ee70 Move remote::update_buffer main logic into Worktree::update_buffer 2021-06-30 11:57:05 +02:00
Nathan Sobo 0fde7a55ef Store shared buffers on LocalWorktree
It's okay for our domain objects to model remote state. We should minimize what we need to store in the rpc::ClientState struct.
2021-06-29 21:01:43 -06:00
Nathan Sobo bbf803d7dc Store a reference to the LangageRegistry on the Worktree 2021-06-29 20:07:37 -06:00
34963ac80d Use entry_id on File instead of worktree::Diff to detect when buffers' files change
Rather than computing a diff after processing a batch of FSEvents, we instead detect renames as we're inserting entries. We store an entry_id on the File object that is owned by each buffer, and use this to detect when the path of the File has changed.

We now also manage all File-related state and event emission for Buffers in the LocalWorktree, since the logic will need to be totally different in the remote case.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-06-29 18:19:38 -06:00
Antonio Scandurra e80439daaa Merge branch 'main' into rpc 2021-06-29 10:25:42 +02:00
Nathan Sobo b7a4393f29 Redesign Worktree save API and make test_rescan_simple pass
This commit does too much. The first goal was to change our approach to saving new buffers so that we don't need to construct a File for an entry that doesn't exist. Rather than doing that, we call `Worktree::save_buffer_as` with the buffer handle, the path, and the contents. This then saves the buffer and returns a handle to a `File` that references an entry that actually exists. I needed to do this so that we can store an entry id on `File`.

In the process, I noticed intermittent test failures on `test_rescan_simple`, so I made some changes required to fix those related to our reuse of existing ids. Our previous approach of removing a path when inserting a new entry was broken, because of the recursive nature of `remove_path`. Instead, I simply recycle the id of an existing worktree entry with the same path if one is present, then allow it to be replaced.
2021-06-28 19:05:38 -06:00
Nathan SoboandAntonio Scandurra 1793eda470 Eagerly populate worktree entries on load
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-06-28 12:29:46 -06:00
Antonio ScandurraandNathan Sobo 958345b5ce Assign a stable identity to Worktree entries
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-06-28 19:41:33 +02:00
Antonio Scandurra 65aa9733d7 Restructure RPC state to also keep track of remote worktrees on guests 2021-06-28 15:35:36 +02:00
Antonio Scandurra e72b4ae03d Maintain active selections as editors are focused and blurred 2021-06-28 12:37:58 +02:00
Antonio Scandurra 0bc8663d36 Remove selection set when an editor is closed 2021-06-28 11:43:21 +02:00
Max Brunsfeld e2b9ab500f Avoid double handle-read in File::buffer_updated 2021-06-25 17:21:42 -07:00
Max Brunsfeld 60ee97be24 Always represent anchor as a versioned offset
Remove the `Start` and `End` variants, and always
use the structure that was previously called `Middle`.
This makes Anchors simpler to serialize and deserialize.
2021-06-25 17:02:48 -07:00
Max BrunsfeldandNathan Sobo b9952bad8b Send and receive buffer operations
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-06-25 16:26:35 -07:00
Max Brunsfeld 04c80578bc Start work on sending buffer operations 2021-06-25 13:46:36 -07:00
Nathan SoboandMax Brunsfeld 7ee0862b99 Notify host when guests close buffers
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-06-25 11:33:40 -07:00
Antonio Scandurra d59267a7ef Move remote module from workspace to worktree 2021-06-25 12:14:04 +02:00
Nathan Sobo 3d67266d0b Add a "retries" option to gpui::test macro and use it in flaky tests 2021-06-24 17:51:16 -06:00
Max Brunsfeld ce2f3f664a Consolidate more logic for joining worktree in Worktree::remote
This way we can use this method in tests and avoid
needing to construct a Workspace.
2021-06-23 18:07:09 -07:00
Max BrunsfeldandNathan Sobo 6a166554e8 Add public method for connecting to RPC server with a given address
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-06-23 18:05:03 -07:00
Max BrunsfeldandNathan Sobo 54c4b31249 Fix last usage of App::test_async in one test
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-06-23 18:05:03 -07:00
Max BrunsfeldandNathan Sobo efc8bc3124 Add a test-support feature flag that enables compilation of zed::test module
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-06-23 18:05:03 -07:00
Antonio Scandurra f1587fbb6e Make replica_id optional in OpenWorktreeResponse 2021-06-23 17:32:05 +02:00
Antonio Scandurra 02321af08a Respond to proto::OpenBuffer requests 2021-06-23 16:20:02 +02:00
Nathan SoboandMax Brunsfeld c5e08b6548 Eagerly update worktree entries when saving
Don't use ModelHandles for storing Files.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-06-22 17:53:35 -07:00