Commit Graph

217 Commits

Author SHA1 Message Date
Antonio Scandurra
45fb470f4d Display language server name in status bar 2022-03-10 16:48:43 +01:00
Antonio Scandurra
4bbf5ed0b9 Listen to all LSP progress notifications and broadcast them to peers 2022-03-10 12:00:33 +01:00
Antonio Scandurra
7546ede288 Split language server initialization from construction
This gives clients a chance to register to notifications.
2022-03-09 12:31:21 +01:00
Max Brunsfeld
4cb4b99c56 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
Antonio Scandurra
317a1bb07b Remove language servers from buffers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-08 15:16:07 -08:00
Antonio Scandurra
51d5ed48f0 Remove unused CloseBuffer message 2022-03-08 11:17:20 +01:00
Antonio Scandurra
d6c8fdb3c4 Send buffer operations via the Project instead of Worktree 2022-03-08 11:11:25 +01:00
Max Brunsfeld
5cc5fa2f93 Populate environment from shell
Co-Authored-By: Keith Simmons <keith@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-07 16:39:50 -08: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
Max Brunsfeld
4124308d94 Fix errors from conditional compilation in timer functions 2022-03-04 17:16:17 -08: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
410ee124af Maintain remote worktrees correctly when building updates
This accidentally regressed in 53327e2.
2022-03-03 16:13:17 +01:00
Antonio Scandurra
14d26eeedc Move several buffer-related messages to the background 2022-03-03 12:18:19 +01:00
Antonio Scandurra
d171d8ccc4 Change the definition of check_invariants
- On the host, ensure that only one worktree can exist for a given absolute
path. Asserting about buffers was cool but I think should be tackled in the
context of leaning more on entry ids for collaboration (vs. buffer ids).
- On the guest, ensure that all the opened buffers don't contain deferred
operations.
2022-03-03 10:51:37 +01:00
Antonio Scandurra
53327e2bf0 Ensure worktree is registered/shared synchronously 2022-03-03 10:10:53 +01:00
Max Brunsfeld
530f15b46b Tweak log format in random collab test 2022-03-02 14:38:16 -08:00
Max Brunsfeld
d4ae38fcee Check projects' buffers have unique absolute paths in random collab test 2022-03-02 14:38:16 -08:00
Antonio Scandurra
68cfce1fb8 Rename weak to visible
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-02 14:38:16 -08:00
Max Brunsfeld
3cf5329450 Flush effects when dropping test clients in random collaboration test 2022-03-01 18:17:25 -08:00
Max Brunsfeld
0e6686916c Remove stray printing in db tests 2022-03-01 12:10:35 -08:00
Max Brunsfeld
43f856c568 Make integration tests depend only on a few core crates, not all of zed 2022-03-01 12:09:51 -08:00
Max Brunsfeld
2b64e8d4a2 Fix failure in test_unshare_project due to dropping handle outside of an update block
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 10:50:58 -08:00
Antonio Scandurra
3e9dbe10d6 Capture a weak reference to the Project in fake LSP 2022-03-01 13:34:03 +01:00
Antonio Scandurra
8d078ed4e2 Don't block when emitting fs events
Blocking could happen while processing events, which would cause the
background scanner to never make any further progress.
2022-03-01 13:08:50 +01:00
Antonio Scandurra
ce59e57e6d Remove project from host connection when unregistering it 2022-03-01 12:18:55 +01: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
Max Brunsfeld
3b7cfad718 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
3788efeadf Clean up guest connection states correctly when a collaborator disconnects
This bug was caught by running the executor until parked after tests.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-28 22:21:32 -08:00
Max Brunsfeld
7d53e37672 Start work on detecting leaked handles in tests
For now, just track models. Tests fail because we don't
yet clear the app contexts at the right time.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-28 22:02:43 -08:00
Max Brunsfeld
d1d324e42b Never close buffers when sharing
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-28 11:36:43 -08:00
Antonio Scandurra
400a2fce58 Don't use a bounded channel for signaling that buffers have been opened
Blocking the sender could halt deserialization for no reason if nobody
is consuming the notifications.
2022-02-28 15:26:10 +01:00
Antonio Scandurra
5f7a759870 Add project-wide search to randomized integration test 2022-02-28 14:22:31 +01:00
Antonio Scandurra
abdfdcdabf Include buffer's deferred ops when computing has_buffered_operations 2022-02-28 14:22:24 +01:00
Nathan Sobo
92f411f01e Extract generic forward_project_request function on server
All these methods did the same thing with different message types.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 15:20:42 -07:00
Nathan Sobo
e822c6a64e Handle project-wide search on guests
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 15:09:47 -07:00
Max Brunsfeld
47b654063e Provide editor styling information separately from editor settings
* Since regular editors' font sizes and families are controlled by
  the settings and not the theme, don't store a dummy text style in
  the theme. Instead, only store a font color, and synthesize
  the text style for regular editors using both the theme and the
  settings.
* Style single-line and auto-height editors (now called "field
  editors") using a single function that takes the entire theme and
  selects a relevant sub-object.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-24 16:42:00 -08:00
Max Brunsfeld
f1921c8df5 Open buffers from definitions request in random collab test
Don't try to open buffers from the weak worktrees directly, as this is
expected to fail if the host drops the buffer for that worktree.
2022-02-23 20:35:05 -08:00
Max Brunsfeld
6060077444 Remove unused pending_updates field from RemoteWorktree 2022-02-23 16:59:39 -08:00
Max Brunsfeld
e9009d4edf Tweak logging in random collaboration test 2022-02-23 16:27:34 -08:00
Max Brunsfeld
170487a528 Fix race conditions with LSP requests that return buffers
* Avoid panic when registering a buffer that was previously open,
  and whose weak handle was still present in the open_buffers map.
* Avoid releasing any buffers while a request is outstanding which
  could return a reference to a buffer.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-23 15:26:01 -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
Antonio Scandurra
9e173564e9 Pass an AsyncAppContext to fake language server request handlers 2022-02-23 16:14:36 +01: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
Max Brunsfeld
5d2201c4ca Add integration test for project symbols
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-22 12:44:17 -08:00
Max Brunsfeld
dbe9c54857 Request definitions as guests in random collaboration integration test
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-22 12:03:45 -08:00