Commit Graph

217 Commits

Author SHA1 Message Date
Max Brunsfeld
64098247cb Allow languages to be registered at any time
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-22 10:35:20 -08: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
Max Brunsfeld
ededfff3a8 Download language servers on-demand
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 13:54:52 -08:00
Antonio Scandurra
aee479d615 Show message indicating when we're downloading language servers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 17:25:52 +01:00
Antonio Scandurra
8913ec6cfd
Merge pull request #455 from zed-industries/rename
Introduce rename support via `F2`
2022-02-19 11:07:39 +01:00
Max Brunsfeld
80bca57bfa Tweak behavior of selections when renaming 2022-02-18 15:44:57 -08:00
Antonio Scandurra
38e4ec9157 Replace Inconsolata with Zed Mono and Zed Sans 2022-02-18 14:55:11 +01:00
Antonio Scandurra
a682ebb08d Add test for preparing and performing a rename 2022-02-18 12:18:01 +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
6d8db5f6bb Convert some project tests to use FakeFs
Also, tweak some FakeFs methods to make them slightly more convenient.
2022-02-17 11:09:27 -08:00
Antonio Scandurra
19b4ecd33a Use a fake database in tests 2022-02-17 17:04:04 +01:00
Antonio Scandurra
0b46e36189 Avoid parsing in randomized collaboration integration test
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-17 15:17:15 +01: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
50a31721eb Wait for version before returning completions 2022-02-17 11:41:19 +01:00
Antonio Scandurra
e824a6f220 Avoid stalling server when test notifications aren't being processed 2022-02-17 10:38:56 +01:00
Antonio Scandurra
1fbcea6c0d Randomly detach requests on guest to let them race with other local ops 2022-02-17 09:05:06 +01:00
Max Brunsfeld
e3c4ce208a Remove unnecessary waiting when handling save RPC requests
Add saving to the randomized integration test

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 17:47:21 -08:00
Max Brunsfeld
3315750361 Remove waiting for edits when handling code action RPC requests
Add code actions to the randomized integration test

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 17:34:23 -08: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
90f31bb123 Allow FakeLanguageServer handlers to handle multiple requests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 16:19:27 -08:00
Max Brunsfeld
c4dff12d69 Allow multiple fake language servers to be started for a given project
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 16:10:36 -08:00
Max Brunsfeld
bee7055634 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 Brunsfeld
93ed34f918 In random collaboration test, compare all guests' buffers to the host's buffers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 11:31:53 -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
0173025f4b Close buffers in randomized integration test
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 17:56:27 +01:00
Antonio Scandurra
38f225b575 Clean db pool on drop only if assertions fail or it's the last iteration 2022-02-16 15:07:41 +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
3f6feb1c12 Compare only snapshot's essential state in random collaboration test 2022-02-16 13:39:55 +01:00
Max Brunsfeld
71abea728e 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 Brunsfeld
34bba303dc In random collaboration test, add failing assertion for worktree convergence 2022-02-15 14:55:38 -08:00
Antonio Scandurra
a11495af19 Start on a randomized integration test 2022-02-15 17:33:43 +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
Nathan Sobo
28ba49b47b Wait for buffer if it doesn't exist when deserializing a reference
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-14 15:55:37 -07:00
Max Brunsfeld
7b666af0cf 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
Max Brunsfeld
bf6ae0d8f8 Restore logic for storing operations on buffers that are still being opened 2022-02-14 11:59:22 -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
1eea2f3653 Add integration test for code actions 2022-02-14 11:42:56 +01:00
Antonio Scandurra
68917c78be Implement Server::add_request_handler in terms of ::add_message_handler 2022-02-14 09:31:31 +01:00
Antonio Scandurra
a41eb5a663 Ensure server always responds when receiving a request 2022-02-13 10:21:01 +01:00
Antonio Scandurra
331667c00e WIP: Start auditing all forward_request calls on the server
When the host returns an error after a server has forwarded a request,
we want to surface that error to the guest. At the moment, the server
just returns early leaving some requests unresponded on the guest.

I started auditing all the code paths where we do that, but I am
wondering whether there's some other approach that would prevent us
from repeating this mistake in other code paths.
2022-02-12 14:12:13 +01:00
Antonio Scandurra
cbe93af3a8 Reduce number of iterations on test_editing_while_guest_opens_buffer
I think this was mistakenly increased as part of some other change.
2022-02-12 13:01:18 +01:00
Antonio Scandurra
ca052b4a4d Make test_propagate_saves_and_fs_changes more robust
...by using a condition that awaits on the actual paths as opposed
to the simple file counts.
2022-02-12 12:37:51 +01:00
Antonio Scandurra
f2b4a0665f Fix integration test verifying the rename behavior
Specifically, the test now ensures that the host's worktree observes a/file1's
change event *before* the rename occurs, otherwise when interpreting the change
event it will mistakenly think that the file has been deleted (because its path
has changed) and will subsequently fail to detect the rename, causing the test
to fail.
2022-02-12 12:26:39 +01:00
Max Brunsfeld
01664d494c Restructure fake language server to setup request handlers in advance
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 15:08:56 -08:00
Antonio Scandurra
a41725daee Render code actions indicator
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 16:01:15 +01:00
Antonio Scandurra
4929b8c525 Move Buffer::format to Project::format 2022-02-11 12:07:46 +01:00
Max Brunsfeld
6731d92f60 Give the editor a handle to the project, not a weak handle to the workspace
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-08 15:48:44 -08:00
Max Brunsfeld
93bcde953c Consolidate logic for completion alongside code actions in Project
This way, completions are dealt with more consistently with code actions,
and the logic is not spread across so many places. The `language::File`
trait and the multibuffer no longer need to deal with completions. Completions
are no longer generic over an anchor type.
2022-02-08 14:24:45 -08:00
Max Brunsfeld
e0fe8b5a7c Merge branch 'main' into assists 2022-02-08 12:41:57 -08:00
Antonio Scandurra
dca974c7d4 Apply code actions remotely 2022-02-08 12:18:14 +01:00
Antonio Scandurra
17114cc6f7 Merge branch 'main' into assists 2022-02-08 09:39:43 +01:00
Max Brunsfeld
050f95149e Clear test db pool whenever no dbs are in use 2022-02-07 18:30:09 -08:00
Max Brunsfeld
c245356b42 Try another hacky approach for tearing down DBs after all tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 15:23:35 -08:00
Max Brunsfeld
b0ed58add3 Run multiple iterations of all integration tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 15:11:41 -08:00
Max Brunsfeld
e3f055d950 Use a pool of databases to speed up integration tests
Also, use env_logger consistently in the tests for each crate.
Only initiallize the logger at all if some RUST_LOG env var is set.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 15:00:00 -08: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
a172c3c5c6 Apply file-system operations coming from an LSP code action
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 16:11:40 +01:00
Antonio Scandurra
982e90539d WIP: Start on applying code actions 2022-02-07 12:20:03 +01:00
Nathan Sobo
ba99b01de6 Generalize showing and hiding of context menus
We still cancel pending completions when hiding the context menu so its not perfectly general, but I think this is ok.
2022-02-05 12:13:02 -07:00
Nathan Sobo
93a3f4b615 Move rendering and select prev/next into ContextMenu enum
This prepares the way to have a code actions context menu.
2022-02-05 10:19:43 -07:00
Max Brunsfeld
3dfff3866a Add integration test for getting and resolving completions 2022-02-03 15:24:16 -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
ed549e352f Start on requesting completions for remote buffers 2022-02-02 12:22:47 +01:00
Max Brunsfeld
8d2b7ba032 Insert completion text on enter
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:46:50 -08: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
Max Brunsfeld
0cfb9ff1ae Add random delays in FakeFs
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-24 16:50:38 -08: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
b7314ef2aa WIP: Start restructuring executor 2022-01-24 18:49:20 +01: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
dabab6e323 Verify simultaneously opening buffers via definition and open_buffer
This fails because we don't yet handle this scenario.
2022-01-24 15:08:04 +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
Antonio Scandurra
31dfd01fda Make add_local_worktree private and use find_or_create_local_worktree
The former always adds a worktree, even if we have one already in the
project and that could be misused. The public API should always search
for a local worktree containing the requested path first so that the
project can uphold invariants about which worktrees it has.
2022-01-22 11:23:00 +01:00
Max Brunsfeld
2712cadaf6 Get integration tests passing
* Fix misuse of guest buffer's id as its remote id

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-21 17:44:24 -08:00
Max Brunsfeld
6751bd9d78 Change integration tests to open buffers via the project 2022-01-21 12:23:17 -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
71082d4cdc Return a Task<Result<()>> in {ItemView,Buffer,MultiBuffer}::save 2022-01-20 09:58:24 +01:00
Max Brunsfeld
e56c043693 Get tests passing, centralize more diagnostic logic in Project 2022-01-19 16:32:55 -08:00
Max Brunsfeld
f43dcd6763 Move logic for starting language servers to the project 2022-01-19 14:05:06 -08:00
Antonio Scandurra
f51cf6b05e Cleanup worktrees' shared state when unsharing 2022-01-17 10:58:49 +01:00
Nathan Sobo
057dc62b90
Merge pull request #338 from zed-industries/use-wildcard-cert
Associate staging and production load balancers with wildcard cert
2022-01-12 17:23:04 -07:00
Nathan Sobo
a93502bb64 Add placeholder environment variables to our deploy
We have the ability to define environment-specific environment variables, but don't current need it. This keeps these files in place while avoiding noise from running `export` with no args due to the files being empty.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-12 16:33:41 -07:00
Nathan Sobo
e71b989041 Use the same wildcard certificate on production and staging
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-12 16:28:09 -07:00
Nathan Sobo
3a82d0d8e1 Use a wildcard cert on DigitalOcean in the staging environment
If this works, we'll use it for production as well and delete the other certs.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-12 16:17:21 -07: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
943571af2a Report backtraces of pending conditions when deterministic executor illegally parks
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-06 13:33:55 -07: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
0bcd0a3f08 Forward events from remote worktrees to their projects 2022-01-04 16:01:25 -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
Nathan Sobo
93a516d588 Fix warning 2021-12-27 18:00:15 -08:00