Commit Graph
135 Commits
Author SHA1 Message Date
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
Max Brunsfeld dc8e216fcb WIP - Maintain a set of open buffers on a LocalWorktree 2021-06-22 12:29:58 -07:00
Nathan SoboandMax Brunsfeld a364839e93 Replace FileHandle with File entity that subscribes to Worktree update events
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-06-21 20:40:40 -06:00
Max BrunsfeldandNathan Sobo cabf6b1f58 Emit a diff event when worktree's snapshot is updated
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-06-21 17:07:56 -07:00
Nathan SoboandMax Brunsfeld 8ae5c0d7d6 Implement worktree::Snapshot::diff
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-06-21 15:08:21 -06:00
Nathan SoboandMax Brunsfeld 1364ba6f5e Allow async background work when polling worktree background snapshot
This prepares us to perform a diff against the previous snapshot before installing a new worktree snapshot on the foreground thread.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-06-21 14:03:29 -06:00
Nathan SoboandMax Brunsfeld 986afd26e9 Remove other_mount_paths
We only needed this when we relied on inodes for file identity, which we no longer attempt to do.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-06-21 13:06:29 -06:00
Antonio Scandurra 5c0f4e572f 💄 2021-06-21 17:30:08 +02:00
Antonio Scandurra 7489e86c47 Fix deadlock when comparing FileHandles when handles are the same 2021-06-21 16:18:18 +02:00
Antonio Scandurra 95024c616e Put back worktree_id in CloseFile and OpenBuffer messages 2021-06-21 14:44:01 +02:00
Antonio Scandurra 2905ce3ba7 WIP: Load remote history 2021-06-21 12:15:58 +02:00
Antonio Scandurra f4d6fbe14f Issue only one OpenFile and CloseFile request per handle 2021-06-21 12:04:38 +02:00
Max Brunsfeld 96c118b4df Stub in more logic for open_file and close_file 2021-06-20 22:36:01 -07:00
Nathan SoboandMax Brunsfeld 0deaa3a61d WIP
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-06-18 17:26:12 -06:00
Max Brunsfeld a2a6d67e1e Start work on implementing ::file on remote WorktreeHandles 2021-06-18 13:32:38 -07:00
Antonio Scandurra f9d8e952f2 WIP 2021-06-18 19:28:39 +02:00
Antonio Scandurra 89d25458ac Add worktree to workspace when joining a remote worktree 2021-06-18 14:52:38 +02:00
Antonio Scandurra 79cac1340e Replace Worktree with an enum
For now this enum only contains a `Local` variant, but the next step is
to add a `Remote` variant that will be constructed when joining a remote
worktree.
2021-06-18 12:07:57 +02:00
Max Brunsfeld 7a88e44264 Add menu command to join worktree using URL on clipboard
Introduce rpc::Client struct that wraps zed_rpc::Peer
2021-06-17 20:42:36 -07:00
Max Brunsfeld 3a78f053f6 Use strings for paths and buffer contents 2021-06-17 16:25:30 -07:00
Antonio ScandurraandNathan Sobo 9de4d73ffb Move RpcClient to zed_rpc and rename it to Peer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-06-16 18:01:26 +02:00
Max Brunsfeld 3db215418c Allow RpcClient to encapsulate arbitrarily many connections 2021-06-15 14:12:42 -07:00
Max BrunsfeldandNathan Sobo e88f33851e Flatten protobuf message namespace
* Remove `FromClient`/`FromServer` distinction.
* Remove `subscribe` concept - clients will need to handle
  unprompted messages from the server.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-06-15 13:06:50 -07:00
Antonio Scandurra 546ce14cb9 Start sharing paths with the server via RPC 2021-06-15 16:14:08 +02:00
Antonio ScandurraandMax Brunsfeld a87d4db155 Change RpcClient methods to take shared references
This will make it easier to spawn a future on gpui's executors
when calling `RpcClient` methods.

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-06-14 19:59:46 +02:00
Antonio Scandurra e071d40058 Use a single Bias enum everywhere 2021-06-04 13:39:57 +02:00
Antonio Scandurra 311e1b0f5e Supply a context when adding summary to Dimension 2021-06-01 12:50:10 +02:00
Max Brunsfeld e8deed44ab Rename context parameters to cx in worktree.rs 2021-05-28 15:01:35 -07:00
Antonio Scandurra aeb68867da Move highlighted_text_in_range from Buffer to buffer::Snapshot 2021-05-25 11:51:29 +02:00
Antonio Scandurra 65cf9b7c1d Remove condition_with_duration for ModelHandle
Also, use a 2s timeout on CI for both `ModelHandle::condition` and
`ViewHandle::condition`.
2021-05-19 14:50:28 +02:00
Nathan Sobo 143ea24875 Reintroduce the 100ms delay when polling worktree entries
This regressed when I switched us over to the simplified async approach. I think it was causing us to contend on the mutex on during startup.
2021-05-17 20:50:00 -06:00
Antonio ScandurraandNathan Sobo 2cdf315d95 WIP: Replace ropey with our own Rope
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-14 18:30:47 +02:00
Antonio ScandurraandMax Brunsfeld 7b98fb33dd WIP: Get the type checker passing...
...but not the borrow checker!

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-05-13 19:24:03 +02:00
Antonio ScandurraandNathan Sobo 0e9441e5cd WIP
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-13 18:35:48 +02:00
Antonio Scandurra 19f51bc480 Rely more on conditions for state derived after worktree changes 2021-05-13 11:25:29 +02:00
Antonio Scandurra eea9cb47fd Use flush_fs_events more after performing synchronous fs mutations
I am not sure I have caught all the examples of this, but in general
I think we always want to perform a `flush_fs_events` as opposed to
`next_scan_complete` when doing synchronous I/O. Indeed, the file
system may inform us about the events caused by the just-performed
I/O over multiple batches, and `next_scan_complete` may return
before seeing all of them.

Note that this also removes a few assertions which were ensuring
that, on start, a worktree's file handle wouldn't know its deleted
status, even if the file didn't exist for sure on disk. However,
now that `file` is an async API, it's possible that by the time the
`FileHandle` is resolved, `Worktree` has already completed scanning.
We test a similar behavior further along in the test where those
assertions were removed, so it felt okay to proceed without them.
2021-05-13 10:25:16 +02:00
Max BrunsfeldandAntonio Scandurra 520cbfb955 Read file's mtime in background when getting a FileHandle
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-05-12 20:13:56 -07:00
Max Brunsfeld 4910bc50c6 Merge branch 'master' into file-changed-on-disk 2021-05-12 16:20:03 -07:00
Nathan Sobo a3be5595dd Pass a handle to the current view model when spawning
Most of the time, we'll want a way to get a reference back to the current view or model, so this facilitates that common case.
2021-05-12 15:28:59 -06:00
Nathan SoboandMax Brunsfeld fa6bd1f926 Introduce AsyncAppContext and simplify spawning
Now when you call spawn in various context, you pass an FnOnce that is called with an AsyncAppContext and returns a static future. This allows you to write async code similar to how our tests work, borrowing the guts of the AsyncAppContext when needed to interact, but using normal async await semantics instead of callbacks.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-05-12 15:16:49 -06:00
Antonio ScandurraandMax Brunsfeld ab04d71508 Use gpui::test in async tests in zed
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-05-12 18:20:49 +02:00
Antonio Scandurra ac2168f1bd Update mtime and is_deleted when saving/loading a file 2021-05-12 14:34:56 +02:00
Max Brunsfeld 040189db3c Add basic handling for buffer's files changing on disk 2021-05-11 16:18:29 -07:00
Antonio ScandurraandNathan Sobo de6376ca80 Mark FileHandle as not deleted right after saving it
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-11 17:26:26 +02:00
Antonio ScandurraandNathan Sobo 45b41465e1 Don't consider scan as being complete until its state is Idle
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-11 16:54:01 +02:00
Antonio ScandurraandNathan Sobo d8f7054f28 Fix saving files in single-file worktrees
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-11 16:46:22 +02:00
Antonio ScandurraandNathan Sobo 02bd9c8420 Make sure next_scan_complete resolves
Sometimes the scan state could change so quickly that the consumer
wouldn't notice that it ever went to a scanning state before going back
to an idle state, hence never resolving.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-11 16:06:12 +02:00
Max BrunsfeldandNathan Sobo ff5561d402 Fix management of buffers' dirty state
* Don't consider files deleted if they just haven't been scanned yet.
* Consider a buffer dirty if its file has been deleted.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-11 15:37:01 +02:00
Max Brunsfeld e32b6bc8f8 Merge branch 'master' into new-file 2021-05-07 10:10:20 -07:00