Commit Graph

274 Commits

Author SHA1 Message Date
Antonio Scandurra
4bbfd0918e Start defining follow protocol
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 16:50:29 +01:00
Antonio Scandurra
7155dabf5b Fade out unnecessary code
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:51:59 +01:00
Max Brunsfeld
38dcd522de Bump protocol version number 2022-03-14 15:57:39 -07:00
Antonio Scandurra
45fb470f4d Display language server name in status bar 2022-03-10 16:48:43 +01:00
Antonio Scandurra
4243f0c339 Render pending language server work in status bar 2022-03-10 16:09:47 +01:00
Antonio Scandurra
4bbf5ed0b9 Listen to all LSP progress notifications and broadcast them to peers 2022-03-10 12:00:33 +01:00
Max Brunsfeld
3dc100adfb Reset receive timeout only on reads from websocket connection, not writes
Also, increase the receive timeout to 30 seconds. We'll still respond immediately
to explicit disconnection, but when there are temporary network blips that
delay pings, we think we should err on the side of keeping the connection
alive. This is in response to a false positive 'host disconnected' state
that we observed when pairing today, while the host (Keith) still clearly
had a working internet connection, because we were screen sharing.

Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-09 11:27:47 -08:00
Antonio Scandurra
51d5ed48f0 Remove unused CloseBuffer message 2022-03-08 11:17:20 +01:00
Max Brunsfeld
1f5eab39a9 Reset peer's receive timeout when a message is received
* Make advance_clock more realistic by waking timers in order,
  instead of all at once.
* Don't advance the clock when simulating random delays.

Co-Authored-By: Keith Simmons <keith@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-07 15:33:43 -08:00
Antonio Scandurra
e579da64c3 WIP: Introduce a read timeout
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-07 17:08:12 +01:00
Max Brunsfeld
fab115e549 Adjust test connection to treat the half-open state more realistically
When a network connection is lost without being explicitly closed by the
other end, writes to that connection will error, but reads will just wait
indefinitely.

This allows the tests to exercise our heartbeat logic.
2022-03-04 16:47:55 -08:00
Max Brunsfeld
9017a1363b Send websocket pings from both the client and the server
Remove the client-only logic for sending protobuf pings.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-04 15:21:18 -08:00
Antonio Scandurra
dc5a09b3f7
Merge pull request #525 from zed-industries/preserve-worktrees
Grow worktrees monotonically when sharing and move most messages to the background
2022-03-04 09:48:18 +01:00
Antonio Scandurra
bcd5c28833 Allow receiving diagnostic updates out of order 2022-03-04 09:27:49 +01:00
Max Brunsfeld
05df1dfae9 Disable doctests for all libraries
We don't use them, and they add a lot of noise to the test output
when running all tests in the workspace.
2022-03-03 16:15:56 -08:00
Antonio Scandurra
556d9cc53f Correctly defer undo operations when messages arrive out of order
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-03 18:07:59 +01:00
Antonio Scandurra
d0d6916167 Move code action and completion edit messages to the background 2022-03-03 13:54:26 +01:00
Antonio Scandurra
14d26eeedc Move several buffer-related messages to the background 2022-03-03 12:18:19 +01: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
a3c8892252 Move SearchProject to the background
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-02 14:38:16 -08:00
Antonio Scandurra
a184583a89 Bump protocol version 2022-03-02 15:08:33 +01:00
Max Brunsfeld
acf7ef3d61 Avoid retaining executor when using Connection::in_memory 2022-03-01 18:02:12 -08:00
Max Brunsfeld
917543cc32 Handle Peer responses using a futures::oneshot instead of postage::mpsc 2022-03-01 13:37:33 -08: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
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
Max Brunsfeld
1278f5484f Add project search RPC messages 2022-02-25 12:38:31 -08:00
Max Brunsfeld
e714b00c26 Improve logging around handling RPC requests on client 2022-02-23 15:37:51 -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
Nathan Sobo
73fcebb8b2 Bump protocol version 2022-02-23 06:33:31 -07: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
Antonio Scandurra
0e4bd4b418 Sign symbols so that we can trust opening buffers for them from guests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-22 18:43:16 +01:00
Antonio Scandurra
fad335b2ba Don't serialize the full LSP symbol when collaborating
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-22 18:08:43 +01:00
Antonio Scandurra
72ad3c2897 Render paths in ProjectSymbolsView
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-22 17:48:14 +01:00
Antonio Scandurra
f0195ac3a3 Allow opening of buffers associated with a project symbol 2022-02-22 16:26:01 +01:00
Antonio Scandurra
2a6d486d14 Retrieve project symbols over RPC 2022-02-22 14:50:06 +01:00
Antonio Scandurra
ab73343323 WIP: Start on getting project symbols over RPC 2022-02-22 12:15:38 +01:00
Antonio Scandurra
f9723ae16b Undo temporary edits before performing rename or canceling it
Also, wire up remote renames.
2022-02-18 11:41:47 +01:00
Max Brunsfeld
54d7642712 Start work on renames 2022-02-17 18:01:07 -08:00
Antonio Scandurra
ebecb6dad4 Use the lowest zstd compression level during tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-17 15:16:51 +01:00
Antonio Scandurra
303e8e1688 Wait for version before returning code actions 2022-02-17 14:46:26 +01:00
Max Brunsfeld
41ba980c9b Remove unnecessary waiting during completion RPC requests
Also, add completion requests to the randomized collaboration integration test,
to demonstrate that this is valid.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 17:23:16 -08:00
Max Brunsfeld
06fb9ccca0 Restore synchronization between responses and incoming messages
This removes the need to buffer pending messages in Client.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-16 10:28:32 -08:00
Max Brunsfeld
cf4291a126 Distinguish between "foreground" and "background" RPC messages
Some types of messages, which entail state updates on the host, should be
processed in the order that they were sent. Other types of messages should
not block the processing of other messages.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-16 10:01:23 -08:00
Antonio Scandurra
20858699bc Add a Test message that we can use to assert on the behavior of Peer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-16 18:32:03 +01:00
Antonio Scandurra
c3ba8f59ed Ensure worktree updates are observed in order on the server 2022-02-16 14:05:10 +01:00
Antonio Scandurra
17b13b9362 Wait for request and response version before resolving completions 2022-02-15 10:17:35 +01:00
Max Brunsfeld
d358072c74 Include the desired version in a SaveBuffer RPC request
When handling this messages on the host, wait until the desired
version has been observed before performing the save.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-14 17:51:26 -08:00
Max Brunsfeld
8d06049124 Ensure worktree updates are applied in order
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-14 16:19:29 -08:00
Max Brunsfeld
fe46b89500 Remove logic for preserving RPC message order between peers
* On the server, spawn a separate task for each incoming message
* In the peer, eliminate the barrier that was used to enforce ordering
  of responses with respect to other incoming messages

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-14 10:51:12 -08:00
Antonio Scandurra
fadb94afb2 Use selection instead of just the cursor when fetching code actions 2022-02-14 14:13:36 +01:00
Antonio Scandurra
1eea2f3653 Add integration test for code actions 2022-02-14 11:42:56 +01:00
Antonio Scandurra
5a7d391d73 Ensure response barrier is always dropped, even if request is canceled 2022-02-12 10:23:50 +01:00
Antonio Scandurra
4929b8c525 Move Buffer::format to Project::format 2022-02-11 12:07:46 +01:00
Antonio Scandurra
7d8641afb6 Make transactions serializable to enable edits on behalf of other users
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-08 19:48:21 +01:00
Antonio Scandurra
6768288da8 Bump protocol version 2022-02-08 15:00:06 +01:00
Antonio Scandurra
624eb5907e Serialize buffer in terms of operations rather than state
This is required because, after joining, we want to be able to refer
to operations that have happened prior to joining, which are not
captured by the state. There is probably a way of reconstructing operations
from the state, but that seems unnecessary and we've already talked about
wanting to have the server store operations rather than state once we start
persisting worktrees.
2022-02-08 14:59:46 +01:00
Antonio Scandurra
dca974c7d4 Apply code actions remotely 2022-02-08 12:18:14 +01:00
Max Brunsfeld
8a2613d49c Preserve ordering between responses and other incoming messages
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 14:14:15 -08:00
Max Brunsfeld
d4fe1115e7 Use an unbounded channel for peer's outgoing messages
Using a bounded channel may have blocked the collaboration server
from making progress handling RPC traffic.

There's no need to apply backpressure to calling code within the
same process - suspending a task that is attempting to call `send` has
an even greater memory cost than just buffering a protobuf message.

We do still want a bounded channel for incoming messages, so that
we provide backpressure to noisy peers - blocking their writes as opposed
to allowing them to buffer arbitrarily many messages in our server.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 12:27:13 -08:00
Antonio Scandurra
d765e75bad Apply additional edits for completion when the buffer is remote 2022-02-02 16:29:13 +01:00
Antonio Scandurra
91e5c2dfac Broadcast completion triggers to remote participants 2022-02-02 14:07:41 +01:00
Antonio Scandurra
ed549e352f Start on requesting completions for remote buffers 2022-02-02 12:22:47 +01:00
Antonio Scandurra
ff24766319 Fix warning
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 15:55:48 +01:00
Max Brunsfeld
0e55f0ccaa Use Rust 2021 edition in all crates
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 12:50:31 -08:00
Antonio Scandurra
02baaa3529 Bump the protocol version
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 17:42:04 +01:00
Max Brunsfeld
2b8685c1a2 Insert random delays when sending and receiving websocket messages in tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-24 16:37:22 -08:00
Antonio Scandurra
96b66dcce1 Fix race condition when opening a buffer and getting a definition to it 2022-01-24 18:47:55 +01:00
Antonio Scandurra
245490f934 Implement Project::definition when the buffer is remote 2022-01-24 13:10:13 +01:00
Antonio Scandurra
f859d444ff Don't show conflict indicator on remote buffer after a reload 2022-01-24 10:17:36 +01:00
Antonio Scandurra
4372fe1ed0 Maintain remote buffers via UpdateBufferFile messages sent by host 2022-01-24 09:32:40 +01:00
Nathan Sobo
da13d028a3 Send File protos as part of Buffer protos
Use the File proto to build the File associated with the buffer rather than relying on the local entry.
2022-01-22 22:19:04 -07:00
Nathan Sobo
e2a2073bdb Remove worktree_path from File struct 2022-01-22 14:29:36 -07:00
Max Brunsfeld
34e42c0c5f Remove worktree_id from buffer-related RPC messages 2022-01-21 16:23:39 -08:00
Antonio Scandurra
6e7e86e491 Remove weak worktrees from project when nobody references them
Also, avoid showing them in the project panel as well as in the
contacts panel.
2022-01-21 14:34:14 +01:00
Antonio Scandurra
6b1f989c2b Omit worktree id when emitting Event::DiskBasedDiagnosticsUpdated
Sometimes we will have more than one worktree associated with the same
language server and in that case it's unclear which worktree id we should
report an event for.
2022-01-20 10:13:27 +01:00
Nathan Sobo
30225678c0 Test ordering of responses with respect to uni-directional messages
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-12 11:19:17 -07:00
Antonio Scandurra
66694b4c9a Fix failing tests
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-12 18:43:23 +01:00
Antonio Scandurra
8b53868f8a Preserve the order of responses with respect to all other incoming messages
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-12 18:26:00 +01:00
Antonio Scandurra
9e4b118214 Use synchronous locks for Peer state
We hold these locks for a short amount of time anyway, and using an
async lock could cause parallel sends to happen in an order different
than the order in which `send`/`request` was called.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:02:41 +01:00
Antonio Scandurra
310def2923 Implement Buffer::format
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:01:20 +01:00
Antonio Scandurra
cf62d26ed8 Display a "Checking..." message when running disk-based diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-07 15:03:19 +01:00
Nathan Sobo
2dbee1d914 Send diagnostic summaries to guests when they join the project
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-06 12:12:09 -07:00
Max Brunsfeld
8728d3292d Merge branch 'main' into polish-project-diagnostics
Also fix false failure in ModelHandle::condition when parking is not forbidden.
2022-01-05 10:53:18 -08:00
Antonio Scandurra
e56609cf0c Ensure prior, deferred selections don't override newer selections 2022-01-05 15:43:26 +01:00
Antonio Scandurra
870fa5f278 Serialize deferred operations 2022-01-05 11:52:41 +01:00
Antonio Scandurra
7bc8eb4f3d Fix compile errors and get serialization unit test passing 2022-01-05 10:29:29 +01:00
Max Brunsfeld
984e366c32 WIP - Serialize buffer in terms of its state, not its base text + ops
The main reason for this is that we need to include information about
a buffer's UndoMap into its protobuf representation. But it's a bit
complex to correctly incorporate this information into the current
protobuf representation.

If we want to continue reusing `Buffer::apply_remote_edit` for
incorporating the historical operations, we need to either make
that method capable of incorporating already-undone edits, or
serialize the UndoMap into undo *operations*, so that we can apply
these undo operations after the fact when deserializing. But this is
not trivial, because an UndoOperation requires information about
the full offset ranges that were undone.
2022-01-04 18:06:16 -08:00
Max Brunsfeld
d8b888c9cb Replicate diagnostic summaries
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-04 14:29:22 -08:00
Antonio Scandurra
508b9dc024 Rip out "diagnostic providers" 2022-01-04 16:32:17 +01:00
Max Brunsfeld
a080ae98c6 Allow the zed app to connect to both the old and new rpc endpoints
In the case of the new Next.js app, the app will follow a redirect
from 'zed.dev/rpc' to the subdomain where the rust service is hosted.
Until then, the app will connect directly to zed.dev/rpc.
2022-01-03 15:29:26 -08:00
Max Brunsfeld
d5a17053df Get code compiling with some todos 2021-12-23 14:21:10 -08:00
Nathan Sobo
e3ecd87081 WIP
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-23 11:24:35 -07:00
Antonio Scandurra
b9d1ca4341 Show only disk-based diagnostics in ProjectDiagnosticsEditor
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-23 16:47:54 +01:00
Max Brunsfeld
1544da887e Start work on preserving continuity of disk-based diagnostics 2021-12-22 12:52:50 -08:00
Antonio Scandurra
40da3b233f Get more integration tests passing 2021-12-21 09:50:11 +01:00
Max Brunsfeld
55910c0d79 Get the server and integration tests compiling 2021-12-20 16:30:29 -08:00
Max Brunsfeld
614ee4eac7 Send worktree info only when sharing worktree
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-20 11:36:59 -08:00
Antonio Scandurra
697e641e8e Get back to a compiling state for client
This temporarily disables some tests and there are still some server-side
compiler errors.
2021-12-20 16:08:34 +01:00
Max Brunsfeld
c41b958829 WIP - start restructuring collaboration around entire projects
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-17 22:00:39 -08:00
Max Brunsfeld
418a9a3d66 Get things compiling with diagnostics on worktree
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-13 11:15:03 -08:00
Antonio Scandurra
85674ba506 WIP
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-13 16:46:35 +01:00
Antonio Scandurra
c984b39aaa Show remote collaborators' active selections 2021-12-13 11:38:38 +01:00
Nathan Sobo
4dd0752e80 More messy progress towards selections in editors 2021-12-11 00:29:34 -07:00
Antonio Scandurra
65711b2256 Remove anchor collections
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-09 17:28:27 +01:00
Nathan Sobo
1445ce10b5 Name the root file of every crate after the crate to ease navigation
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-30 12:46:39 -07:00
Nathan Sobo
eacd2a45bb Bump versions in preparation for release 2021-11-30 09:43:51 -07:00
Nathan Sobo
4bd43e67ef Introduce a TestClient and associate it with a PeerId
This makes it easier to integration test peer interactions because now we know their PeerIds.
2021-11-27 12:33:25 -07:00
Nathan Sobo
b307a7e91d Populate the user data of worktree collaborators
This will make it possible for us to render their avatars. Previously we only had the user ids. During rendering, everything needs to be available synchronously. So now, whenever collaborators are added, we perform the async I/O to fetch their user data prior to adding them to the worktree.
2021-11-26 20:35:50 -07:00
Nathan Sobo
c8ad5b68e0 Rename collaborator_logins to authorized_logins
Again, this is about reserving the concept of a "collaborator" for actual collaborators on a worktree.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-26 11:08:34 -07:00
Nathan Sobo
cd2c3c3606 Rename Collaborators to Contacts
This will allow us to use the word "collaborator" to describe users that are actively collaborating on a worktree.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-26 10:59:41 -07:00
Nathan Sobo
9f29eeda03 Associate Peers with a user_id
This will help us render the collaborator avatars for the active worktree when we know its peers.
2021-11-26 10:22:34 -07:00
Max Brunsfeld
c13a26ff7b Bump RPC protocol version 2021-11-22 13:33:05 -08:00
Max Brunsfeld
7474813a17 Impose a timeout on writing RPC messages
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-22 13:23:55 -08:00
Antonio Scandurra
0e51365770 In a diagnostic group, mark the highest-severity diagnostic as primary
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 15:53:00 +01:00
Antonio Scandurra
78bbb83448 Assign diagnostics a group_id based on their related_information
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-04 14:52:34 +01:00
Max Brunsfeld
0e62ddbb65 Replicate diagnostics to remote buffers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-01 15:28:37 -07:00
Nathan Sobo
1a92a19954 Remove Anchor from protocol 2021-10-26 12:04:04 -06:00
Nathan Sobo
6ba4af3e26 WIP: Start converting SelectionSet to use AnchorRangeMap 2021-10-22 13:19:19 -06:00
Nathan Sobo
401bdf0ba1 Simplify protocol messages related to selection sets
This prepares the way to switch to using AnchorRangeMaps to store and transmit selection sets.
2021-10-22 12:35:29 -06:00
Nathan Sobo
d5b60ad124 Rename zrpc to rpc
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-10-04 13:28:00 -06:00