Commit Graph
44 Commits
Author SHA1 Message Date
Max Brunsfeld 397149a097 Tear down client's connection states when dropping test clients 2022-03-01 18:17:41 -08:00
Antonio Scandurra 79568c471a 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 6955c5d781 Avoid reference cycle between Client and its models 2022-03-01 10:55:05 +01:00
Max BrunsfeldandNathan Sobo 3d5668c383 Try clearing Client's state at the ends of integration tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-28 22:52:21 -08:00
Max Brunsfeld b64693b4bb Hold client weakly in UserStore
This avoids a reference cycle that is causing some tests
to fail due to leaked handles at the moment. There may be
a better way to fix this though.
2022-02-28 22:47:50 -08:00
Max Brunsfeld 96474a111f Make client log message format more consistent 2022-02-23 18:18:52 -08:00
Max Brunsfeld 043b45e9d4 Improve logging around handling RPC requests on client 2022-02-23 15:37:51 -08:00
Max BrunsfeldandNathan Sobo c9a4d76f2d Download language servers on-demand
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 13:54:52 -08:00
Antonio Scandurra f49935670f WIP 2022-02-18 10:47:22 -08:00
Max Brunsfeld 5fb15676ec Fix chat channel unit test
Also, improve error in tests when FakeServer never receives a request,
using the new `start_waiting` method on the DeterministicExecutor.
2022-02-16 13:54:00 -08:00
Max BrunsfeldandNathan Sobo b656ff841c Avoid storing operations when no buffers are being loaded
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 11:54:49 -08:00
Max BrunsfeldandAntonio Scandurra 905c66d153 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
Antonio Scandurra 7233c5fd01 Buffer messages in Client while no entity is listening to them 2022-02-16 11:49:37 +01:00
Max BrunsfeldandNathan Sobo 5442f09c07 WIP - Register client RPC handlers on app startup
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-15 18:03:06 -08:00
Max BrunsfeldandNathan Sobo 50aa5a8752 Get chat integration tests passing
* Don't send a chat message before the previous chat message
  is acknowledged.
* Fix emitting of notifications in RPC server

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-14 12:38:10 -08:00
Antonio Scandurra 04e0b7f5fc Add integration test for code actions 2022-02-14 11:42:56 +01:00
Antonio Scandurra 7f44520436 Rename subscribe to add_{message,request}_handler in Client
This makes it easier to distinguish between messages and requests.
2022-02-14 09:25:31 +01:00
Antonio Scandurra 2fa50883d4 🎨 2022-02-14 09:22:10 +01:00
Antonio Scandurra 8fca79272a Ensure client always responds when receiving a request 2022-02-13 12:21:35 +01:00
Max BrunsfeldandNathan Sobo 2e066f25dd Preserve ordering between responses and other incoming messages
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 14:14:15 -08:00
693dd137cf 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
Max BrunsfeldandNathan Sobo 4b081bd128 Use Rust 2021 edition in all crates
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 12:50:31 -08:00
Max BrunsfeldandNathan Sobo f429bdf96e 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
9a81215e58 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 ScandurraandNathan Sobo f31deedac3 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 ScandurraandNathan Sobo f883ffb4f2 Implement Buffer::format
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:01:20 +01:00
Antonio Scandurra 83064671dd Merge pull request #314 from zed-industries/auto-connect
Auto-connect to server on startup if credentials are on the keychain
2022-01-11 18:34:20 +01:00
Antonio Scandurra 86683a87e2 Don't register an entity ID extractor for non-entity subscriptions
This commit fixes a panic that could occur when registering N subscriptions for
N entities of the same kind. Before, when dropping the first of the
subscriptions, we would remove the entity ID extractor as well. This was,
however, used by all the other N - 1 subscriptions which would then start
losing messages. In addition, dropping yet another subscription of that kind
would result in a panic, because we wouldn't find the extractor in the map
upon invoking `Subscription::drop`.

With this change we will avoid removing the ID extractor when dropping a
subscription. Crucially, we also avoid inserting extractors for simple message
subscriptions. This enables these non-entity subscriptions to be dropped and
re-registered without seeing a "registered handler for the same message twice"
panic.
2022-01-11 08:21:35 +01:00
Antonio Scandurra 12c11fcf8d 🎨 2022-01-10 16:10:29 +01:00
Antonio Scandurra e7c1ba181f Fix panic if subscribing after dropping a subscription for the same message 2022-01-10 16:09:06 +01:00
Antonio Scandurra 35c768fadd Don't panic when dropping a subscription in a subscription handler 2022-01-10 16:04:49 +01:00
Antonio Scandurra 389c472375 Fix dev dependencies in client/Cargo.toml 2022-01-10 16:03:55 +01:00
Antonio Scandurra b826ba18ce Auto-connect to server on startup if credentials are on the keychain 2022-01-10 15:06:38 +01:00
Max Brunsfeld cd7ae96c44 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
Nathan Sobo 3e51b188d8 Enable authentication via the NextJS site 2021-12-25 11:55:10 -07:00
Max BrunsfeldandNathan Sobo 2b7b99248a WIP - start restructuring collaboration around entire projects
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-17 22:00:39 -08:00
Nathan SoboandMax Brunsfeld 93322a4858 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
Max BrunsfeldandNathan Sobo ca11c68a19 Introduce weak_handle methods on ModelContext and ViewContext
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 14:13:22 -08:00
Nathan Sobo 306c3e9a1b 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 fe66755e30 WIP: Give worktrees a reference to the UserStore
This will allow them to fetch user data when peers are added or removed. Still work to do though.
2021-11-26 19:12:12 -07:00
Nathan SoboandAntonio Scandurra 7754a5a6bc 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
Antonio Scandurra 3dc173cf40 Move workspace module into its own crate 2021-10-05 13:49:10 +02:00
Max BrunsfeldandNathan Sobo 06a44e9171 Move ChannelList, UserStore into client crate
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-04 17:30:11 -07:00
Max BrunsfeldandNathan Sobo 95c15b11b1 Rename rpc_client -> client
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-04 17:14:21 -07:00