Commit Graph
57 Commits
Author SHA1 Message Date
Max Brunsfeld e57e6eb66c Merge branch 'main' into namespace-actions 2022-04-08 11:48:43 -07:00
Antonio ScandurraandNathan Sobo ea2de7c1d2 Remove postage from rpc
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-04-08 16:13:37 +02:00
0cf9925cb1 Restructure action macro to assign a namespace to every action
Also, allow arbitrary types to be used as Actions via the impl_actions macro

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-07 16:20:49 -07:00
Nathan SoboandMax Brunsfeld bc4956e837 Authenticate on startup if ZED_IMPERSONATE is assigned
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-03-23 12:25:06 -06:00
Nathan SoboandMax Brunsfeld 8b684e14dc Don't try keychain after authentication fails
Previously, we were achieving this by deleting the keychain item, but this can sometimes fail which leads to an infinite loop. Now, we explicitly never try the keychain when reattempting authentication after authentication fails.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-03-23 12:15:36 -06:00
Max Brunsfeld 9d50d10dee 🎨 client
Forgot to push this yesterday night.
2022-03-18 13:03:43 -07:00
Antonio Scandurra d37930e006 Serialize initial follow state in leader and reflect it in follower 2022-03-18 10:22:13 +01:00
Max Brunsfeld 6360072b43 WIP 2022-03-17 17:53:49 -07:00
Antonio Scandurra 583377a39d Don't starve main thread when lots of messages/events arrive at once 2022-03-11 10:09:13 +01:00
Max Brunsfeld bfc721db27 Assign buffer's completion triggers from LSP capabilities
Also, make LanguageServer::new() async. The future resolves
once the server is initialized.
2022-03-08 17:41:52 -08:00
a5c807cd7a 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
Max Brunsfeld 86d1ba1d65 Fix errors from conditional compilation in timer functions 2022-03-04 17:16:17 -08:00
Max Brunsfeld 310269e0d6 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
b2112ad40e 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 ScandurraandNathan Sobo 3390e055b9 Render overlay after remote project becomes read-only
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 17:28:18 +01:00
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 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 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