Commit Graph

1616 Commits

Author SHA1 Message Date
Max Brunsfeld
9a6819b899 For single-file worktrees start LSP with parent dir as CWD 2022-03-10 16:06:12 -08:00
Max Brunsfeld
44a68b723c Add cmd-, as a keybinding for opening settings 2022-03-10 15:51:57 -08:00
Nathan Sobo
94bf3366f6 Focus in-progress rename editor when editor is focused 2022-03-10 16:42:20 -07:00
Nathan Sobo
a498cd32c8 When renaming, match the color of the renamed token in the rename editor 2022-03-10 16:38:45 -07:00
Max Brunsfeld
f32107eb8e Always refresh the windows when the settings change 2022-03-10 15:34:04 -08:00
Max Brunsfeld
00056fbe88 Load the settings file on a background thread during startup 2022-03-10 15:25:22 -08:00
Nathan Sobo
69ce021f32 Remove unused variable 2022-03-10 15:27:29 -07:00
Nathan Sobo
3968b37e26 When renaming, fade out the old name and select all 2022-03-10 14:55:31 -07:00
Keith Simmons
5502c00d9a swap default cursor shape back to bar 2022-03-10 13:28:13 -08:00
Keith Simmons
5b35c68d2e Fix failing gpui test from missing cursor shape 2022-03-10 13:20:45 -08:00
Keith Simmons
eddb089f27 render character under block cursor 2022-03-10 13:16:31 -08:00
Nathan Sobo
e6b1fea117 WIP 2022-03-10 11:32:14 -07:00
Antonio Scandurra
5157b42896 Extract a LanguageServerStatus struct 2022-03-10 18:43:56 +01: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
Antonio Scandurra
ee6d7fc6d5 Delete till previous tabstop when backspacing within indent column 2022-03-10 10:28:24 +01:00
Keith Simmons
0d42c85195 fix formatting 2022-03-10 01:09:25 -08:00
Keith Simmons
178442a4a8 Add support for rendering cursors as a block and underscore 2022-03-10 01:09:02 -08:00
Nathan Sobo
ac1eb19f83 Start on text highlight support 2022-03-09 20:51:35 -07:00
Nathan Sobo
49e38e6e00 Eliminate ToFoldPoint trait
Just make it a method on FoldMap
2022-03-09 20:49:18 -07:00
Max Brunsfeld
a971306381 Reload the app settings whenever ~/.zed/settings.json changes 2022-03-09 18:00:09 -08:00
Max Brunsfeld
83f98dde52 Start work on loading settings from a file
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-09 17:59:29 -08:00
Keith Simmons
6ee0cceb14 Switch to using mouse navigation events instead of other in order to get rid of opaque button id 2022-03-09 15:04:04 -08: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
Keith Simmons
508c4df79b
Merge pull request #565 from zed-industries/eager-theme-selector
Make theme selector eagerly display the selected theme
2022-03-09 11:00:28 -08:00
Keith Simmons
5aad1ff788 formatting fixes 2022-03-09 10:42:27 -08:00
Keith Simmons
853acccbc2 Make theme selector match other selector styling 2022-03-09 10:40:30 -08:00
Keith Simmons
99e34db0ec ensure that we set original theme when dismissing theme selector and fix some minor edge cases 2022-03-09 10:34:52 -08:00
Antonio Scandurra
f15e3177d3
Merge pull request #569 from zed-industries/refine-autoclose
Refine bracket auto-closing behavior
2022-03-09 16:28:35 +01:00
Antonio Scandurra
97da93c9ec 💄 2022-03-09 15:44:58 +01:00
Antonio Scandurra
d9b3f04436 Surround selections with brackets when they are non-empty 2022-03-09 15:41:54 +01:00
Antonio Scandurra
f54ce8a19c Autoclose bracket only if next char is whitespace or the end of a pair 2022-03-09 15:38:17 +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
Antonio Scandurra
ef1ec88523 Remove delegate support from GPUI
We added this because we thought it would save some allocations when
sending operations given that we could move them to the delegate upon
notifying it, but the reality is that we serialize operations and that
only requires a reference.
2022-03-09 10:48:52 +01:00
Antonio Scandurra
0a9595b5fa Notify all language servers only when a buffer is saved
Other notifications such as opening, closing or changing a document
are still tied to the buffer's language.
2022-03-09 10:44:03 +01:00
Keith Simmons
b440a51675 Make theme selector eagerly display the selected theme 2022-03-08 18:42:31 -08: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
Keith Simmons
fc36c706d3 Add missing mouse button events and mouse history navigation
Co-Authored-By: Max Brunsfeld
Co-Authored-By: Nathan Sobo
2022-03-08 15:45:36 -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
6662ba62a3 Move DidSaveTextDocument notification from Buffer to Project 2022-03-08 11:35:54 +01: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
Antonio Scandurra
b49951ac57 Implement {ModelHandle,ViewHandle}::become_delegate 2022-03-08 09:30:32 +01:00
Nathan Sobo
f2848a092b WIP: Start on a delegation... like events, but single consumer that takes ownership of event 2022-03-08 09:01:57 +01:00
Antonio Scandurra
03aa906068 v0.19.0 2022-03-08 08:18:51 +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
bb6ab837cf
Merge pull request #542 from zed-industries/guest-disconnections
Send heartbeats in both directions so the server can detect when clients disconnect
2022-03-07 15:52:35 -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
Antonio Scandurra
e579da64c3 WIP: Introduce a read timeout
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-07 17:08:12 +01:00
Nathan Sobo
40c0b9e7a5 Halt keystroke dispatch when a global action is dispatched 2022-03-06 09:46:33 -07:00
Antonio Scandurra
711de5edcb Ensure active_item_index doesn't go off the end when closing items
This fixes a bug introduced in #538, where closing the current tab would hide
all the other tabs, if the current tab was the last one.

Also, this commit manually sets the active item index instead of calling
`Pane::activate_item`: even though this introduces a little bit of duplication,
it prevents us from mistakenly calling `deactivate` on the wrong item. This would
happen because `activate_item` looks at `self.active_item_index` to determine
which item to deactivate before setting the new one. However, that index is
potentially invalid because `::close_items` manipulates the `item_views` vector,
so `activate_item` could end up calling `deactivate` on an item view that was
not active in the first place.
2022-03-05 10:52:55 +01:00
Antonio Scandurra
c7ddb66795
Merge pull request #538 from zed-industries/close-inactive-items
Implement close inactive items
2022-03-05 10:35:22 +01: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
Max Brunsfeld
c61a1bd659 Make timer method available on both foreground and background executors
Also, make it return a static future.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 13:54:07 -08:00
Max Brunsfeld
1982a8c27d Put vector clock serialization logic alongside other serialization logic
This way, the `clock` crate doesn't depend on the `rpc` crate.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 13:54:07 -08:00
Max Brunsfeld
28bacabc4e Move Network test helper from util crate into text crate
This way, `util` does not depend on `clock`.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 13:54:07 -08:00
Nathan Sobo
8b9f41175b Use the macOS standard binding instead of VS Code's
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-03-04 10:39:11 -07:00
Nathan Sobo
3057b38fad Implement close inactive items action
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-03-04 10:36:51 -07:00
Nathan Sobo
a72d58a28c Merge branch 'main' into disconnected-status 2022-03-04 10:07:26 -07:00
Nathan Sobo
d59451fb08 Fix tests after font update
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-04 10:06:21 -07:00
Antonio Scandurra
c38de3243d 🎨
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 17:54:48 +01:00
Antonio Scandurra
38313abc48 Disable events when project becomes read-only
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 17:37:37 +01:00
Antonio Scandurra
77e913b5a4 Blur focused view when project becomes read-only
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 17:37:26 +01:00
Antonio Scandurra
b21d91db22 Render overlay after remote project becomes read-only
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 17:28:18 +01:00
Nate Butler
38e32f368d Update zed fonts to 1.2.0 2022-03-04 11:05:34 -05:00
Antonio Scandurra
6ee5e96d7b
Merge pull request #534 from zed-industries/create-buffers-via-project
Open untitled buffers via the `Project`
2022-03-04 16:18:02 +01:00
Antonio Scandurra
29cad65ce0 Open untitled buffers via the Project
This allows the registration of such buffers in the project, which is necessary
to correctly support `::save_buffer_as` and opens the door to sharing untitled
buffers with guests in the future.

Note that, for now, this disallows guests to create untitled buffers in the
current window and will create a new window instead. This is because we don't
yet have a global way of allocating a buffer's remote id (nor a way of saving
such buffers in the host's worktree) and we instead rely on the local model ID,
which could clash with the host's buffer IDs.

I think we should revisit this once guests can share their untitled buffers
with the host and other remote peers, as well as once we start keying
operations by entry id.
2022-03-04 15:25:39 +01:00
Antonio Scandurra
d8ef3a5d61 Support formatting in fake LSP capabilities 2022-03-04 11:24:18 +01:00
Antonio Scandurra
46da80d726 Use LSP range formatting when document formatting is not available 2022-03-04 10:13:17 +01: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
7c420050c7 Observe selection set lamport timestamps when deserializing buffer 2022-03-04 09:34:30 +01:00
Antonio Scandurra
bcd5c28833 Allow receiving diagnostic updates out of order 2022-03-04 09:27:49 +01:00
Max Brunsfeld
19658139b1 Avoid infinite loop when a language server fails to start 2022-03-03 18:13:38 -08: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
Max Brunsfeld
3c242a43d2 Wait for LSP capabilities to be initialized before checking them 2022-03-03 15:59:03 -08:00
Max Brunsfeld
78d96a05fc Make fake language servers have full capabilities 2022-03-03 15:42:29 -08:00
Max Brunsfeld
9999862016 Enable formatting feature of JSON language server
The feature doesn't work yet because the JSON language server
only supports *range* formatting, not document formatting.
We need to adjust our code to inspect the server's capabilities
and send range formatting requests instead when needed.

We're going to hold off on doing this right now, because it
will create merge conflicts with the `preserve-worktrees`
branch (#525)

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-03 14:16:58 -08:00
Max Brunsfeld
81627a0f14 Avoid sending unhandled LSP requests to JSON language server
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-03 13:39:40 -08:00
Max Brunsfeld
0582c557e3 Add JSON language server
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-03 13:29:25 -08:00
Max Brunsfeld
bf1153cedd Add syntax highlighting/auto-indent/outlines for JSON files
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-03 12:12:18 -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
410ee124af Maintain remote worktrees correctly when building updates
This accidentally regressed in 53327e2.
2022-03-03 16:13:17 +01:00
Antonio Scandurra
c613b22619 Ignore diagnostics received for invisible worktrees 2022-03-03 13:58:55 +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
1c14168f38 Ensure no two worktrees can point to the same root path
This could happen because there was a pause between creating the worktree
and adding it to the list of tracked local worktrees, and so we might end
up adding the same worktree twice when calling `create_local_worktree` in
rapid succession.
2022-03-03 10:54:52 +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
Max Brunsfeld
ca920e1552 Rename strong_worktrees -> visible_worktrees 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
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
07120d47f9 Convert weak worktree handles into strong handles when sharing
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-02 14:38:16 -08:00
Max Brunsfeld
4b0300daea 0.18.1 2022-03-02 14:23:19 -08:00
Max Brunsfeld
5c1aff1143 Don't insert input into editors when control or command keys are held
This is a follow-up to #475
2022-03-02 14:09:46 -08:00
Antonio Scandurra
07c780bd72 Make pane active when activating one of its items 2022-03-02 16:52:35 +01:00
Antonio Scandurra
a184583a89 Bump protocol version 2022-03-02 15:08:33 +01:00
Antonio Scandurra
85a010bfcc v0.18.0 2022-03-02 15:05:49 +01:00
Antonio Scandurra
141e0559a5 Fix warnings 2022-03-02 12:45:49 +01:00
Antonio Scandurra
3ec76b63d3 Make dhat optional 2022-03-02 11:02:10 +01:00
Antonio Scandurra
51345cf1e1 Advance clock when simulating random delay 2022-03-02 10:39:46 +01:00
Antonio Scandurra
be7a4770fb Delete timer state when the future that's awaiting it gets dropped 2022-03-02 10:08:38 +01:00
Max Brunsfeld
8b7a9367fa Avoid storing type name string on AnyViewHandle
It won't be needed for leak error messages, because the typed
view handle will typically be created first. And this avoids
increasing the size of the handle used in production.
2022-03-01 18:22:09 -08:00
Max Brunsfeld
ae93cfed50 Tear down client's connection states when dropping test clients 2022-03-01 18:17:41 -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
acf7ef3d61 Avoid retaining executor when using Connection::in_memory 2022-03-01 18:02:12 -08:00
Max Brunsfeld
95b2f4fb16 Fix remaining language server hangs on shutdown
* Use fork of async-pipe library that handles closed pipes correctly.
* Clear response handlers map when terminating output task, so as
  to wake any pending request futures.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 15:54:59 -08:00
Max Brunsfeld
917543cc32 Handle Peer responses using a futures::oneshot instead of postage::mpsc 2022-03-01 13:37:33 -08:00
Max Brunsfeld
f2f1a52c7e Prevent hangs in lsp requests made while server is shutting down
* Avoid postage::oneshot, since receiver is not woken when sender is dropped.
* Clear the response channels when an IO task exits.
2022-03-01 13:36:49 -08:00
Max Brunsfeld
74469a46ba Clean up tasks properly when dropping a FakeLanguageServer
* Make sure the fake's IO tasks are stopped
* Ensure that the fake's stdout is closed, so that the corresponding language
  server's IO tasks are woken up and halted.
2022-03-01 13:26:59 -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
efe7f61128 Use simulate_random_delay when polling snapshot only in tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-01 19:17:38 +01:00
Antonio Scandurra
a25f21df39 Remove debug_elements_callbacks from App
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-01 19:16:58 +01:00
Antonio Scandurra
bc9c034baa Fix Presenter leak when removing windows 2022-03-01 18:50:05 +01:00
Antonio Scandurra
c661ff251d Revert "Use async_broadcast to emit fake FS events"
This reverts commit 4cfd345f9d, because
having a bounded broadcast introduces the possibility of waiting forever
when there isn't yet a receiver processing those events.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 17:14:40 +01:00
Antonio Scandurra
992328a6ee Forbid parking in project_panel::tests::test_visible_list
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 17:14:18 +01:00
Antonio Scandurra
0bb7189842 Use a weak handle to poll local worktree snapshot
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 17:08:10 +01:00
Antonio Scandurra
83a3402235 Make TestAppContext and its dependencies available only in tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 17:01:52 +01:00
Antonio Scandurra
0d6f6bf5bb Detect when view handles are leaked
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 16:11:12 +01:00
Antonio Scandurra
aa03ebce0e Enable leak backtraces by setting LEAK_BACKTRACE=1
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 16:00:40 +01:00
Antonio Scandurra
4cfd345f9d Use async_broadcast to emit fake FS events
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 15:48:15 +01: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
Antonio Scandurra
8390f04e7d Allow capturing references in the future passed to Deterministic::run 2022-03-01 11:59:58 +01:00
Antonio Scandurra
7ce6f23ed4 Remove all windows on dropping TestAppContext
This allows us to remove the dropped entities and flush effects as
necessary.
2022-03-01 10:55:12 +01:00
Antonio Scandurra
10a872a370 Avoid reference cycle between Client and its models 2022-03-01 10:55:05 +01:00
Max Brunsfeld
471ecae82c WIP - include dhat for memory profiling tests 2022-02-28 22:52:21 -08: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
02ae2d8a4f 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
1faaa91e52 Avoid retaining executor in the FakeFs
This probably isn't the *root* cause of why an executor is leaked,
but by cutting off this cyclic references, it may make it a bit easier
to track down leaks of an executor.
2022-02-28 22:40:04 -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
c09921e790 Clear the executor at the end of a test by running until it is parked 2022-02-28 22:20:03 -08:00
Max Brunsfeld
426e0e3d4f Flush effects when dropping a TestAppContext
This way, at the end of a test, dropped entities will be removed, and will drop
the handles that they hold.
2022-02-28 22:17:20 -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
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
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
1313ca8415 Don't delete buffer state when calling get_open_buffer
...as we might be in the process of completing a request that could
open a buffer. This was causing a failure in the randomized integration
test.
2022-02-28 14:27:31 +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
Antonio Scandurra
720056d0db Add unit test for project search 2022-02-28 11:10:22 +01:00
Antonio Scandurra
ed89475cf6 Extract a common match_index_for_direction and active_match_index 2022-02-28 10:34:11 +01:00
Nathan Sobo
8eba96424e Fix warning 2022-02-27 18:17:15 -07:00
Nathan Sobo
cb230ad574 Re-activate the most recently-activated project search on cmd-shift-F
This commits adds the beginnings of an application state facility as a non-static place to store the most recently-activated search for each project.

I also store workspace items by descending order of their entity id so that we always fetch the newest item of a given type when calling `Workspace::item_of_type`.
2022-02-27 18:07:46 -07:00
Nathan Sobo
1ddae2adfd Focus the project find results editor on a tab in the query editor 2022-02-27 16:15:06 -07:00
Nathan Sobo
71241b1fb8 Add capture phase for action dispatch
Just like the DOM, we now bubble events down the tree during a capture phase before bubbling them back up.
2022-02-27 16:14:40 -07:00
Nathan Sobo
7d119dcd54 Select first match when results are ready 2022-02-27 14:24:06 -07:00
Nathan Sobo
7831979be0 Fix warning 2022-02-27 14:21:28 -07:00
Nathan Sobo
64d22925c2 Implement navigation between project search matches 2022-02-27 14:18:04 -07:00
Nathan Sobo
7ef98fb935 Make versions oldest_selection and newest_selection that don't require snapshots
I thought I needed this but actually didn't, but I still kinda think it's a good change for the public interface of Editor.
2022-02-27 13:02:09 -07:00
Nathan Sobo
19b5de2181 Introduce ProjectSearchView constructor
We had some duplication when cloning on split, so this is to unify that before we add any more complexity to construction.
2022-02-27 09:49:16 -07:00
Nathan Sobo
dabb17a2ef Clone editor's searchable state on split 2022-02-27 09:48:46 -07:00
Nathan Sobo
136699e7bd Add log dependency in search crate 2022-02-27 09:25:40 -07:00
Nathan Sobo
c7338ebe88 💄 2022-02-27 09:25:27 -07:00
Nathan Sobo
039765b698 Limit project search tab label to 24 characters
I'd love to fade the text out, but for now I just append an ellipsis.
2022-02-27 08:27:02 -07:00
Nathan Sobo
ec317159d7 Rename "find" to "search"
Search is both a verb and a noun, which makes it more natural to use in situations where we need to name a thing rather than a process.
2022-02-27 08:15:38 -07:00
Nathan Sobo
dd6f8d20a3 Remove carriage returns 2022-02-27 07:47:46 -07:00
Nathan Sobo
28b71cbc03 Select query when focusing query editor
Also: Clear the selection when we focus the results editor because we continue to render the selection even when the editor isn't focused and it looks awkward. Another approach we could take is to not render selections for non-focused editors, either always or with an option. But considering that we select all anyways next time we return focus to the query editor, I think this is ok for now.
2022-02-26 14:12:31 -07:00
Nathan Sobo
e96d0a9355 Activate the *newest* existing project find view on cmd-shift-F 2022-02-26 14:03:14 -07:00
Nathan Sobo
2f427769df Allow a new search to be created with cmd-enter
This replaces the `cmd-alt-shift-F` binding to open a new search. Instead, you can preserve the existing search results by entering a query and then hitting `cmd-enter` instead of `enter`. This opens a new project find view and restores the previous view to whatever query it was previously displaying. It's a bit strange, but I don't want to rely on splitting as the only way of creating multiple sets of search results.
2022-02-26 13:23:05 -07:00
Nathan Sobo
ae1a46a4e4 Render a magnifier icon and the query in project search tab
Also: Wire up events so the modified status updates correctly.
2022-02-26 08:21:38 -07:00
Antonio Scandurra
a78fe4ef6a Don't focus results editor on cmd-shift-f when there are no results 2022-02-26 14:43:02 +01:00
Antonio Scandurra
afea5a3d5e 🎨 2022-02-26 14:31:36 +01:00
Nathan Sobo
f6b7cbd5cf Always open a new project find on alt-cmd-shift-F 2022-02-25 19:48:43 -07:00
Nathan Sobo
60710fa5d5 Only store one nav history entry when opening excerpts
Also: Introduce the ability to disable and enable the nav history directly. This allows us to explicitly push an entry when opening excerpts and then disable all pushes as we open individual buffers.
2022-02-25 19:26:15 -07:00
Nathan Sobo
721258911c Open excerpts on alt-enter
Also: Remove special handling for alt-shift-D binding in diagnostics view that opens excerpts. Rely on alt-enter in all multi-buffers instead.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 16:49:28 -07:00
Nathan Sobo
dea40c5d1a Don't show buffer search UI on ProjectSearchView
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 16:14:45 -07:00
Nathan Sobo
ed6c8b1836 Allow actions to be propagated from nested ViewContexts
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 16:14:16 -07:00
Nathan Sobo
d5cc3fea3d Implement Debug for keymap::MatchResult
Helpful when debugging issues with keystroke dispatch.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 16:13:53 -07: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
1278f5484f Add project search RPC messages 2022-02-25 12:38:31 -08:00
Max Brunsfeld
8dce91be23 Upgrade time crates to silence warning on Rust 1.59 2022-02-25 10:39:44 -08:00
Max Brunsfeld
9a97588f79 Eliminate RwLock around LanguageServer's outbound message channel
We observed a deadlock when quitting zed. The main thread was attempting
to acquire a write lock to this outbound message sender. We weren't able
to understand exactly how this occurred, but we removed the use of a
lock there, so this shouldn't happen anymore.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-25 10:04:57 -08:00
Antonio Scandurra
368301fcec Reuse a previous project find whenever possible
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-25 18:30:28 +01:00
Antonio Scandurra
e278c423d3 Don't assume that cloning on split will reuse the same underlying model
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-25 18:30:04 +01:00
Antonio Scandurra
7123407f42 Don't share query editor state after project find has been split
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-25 18:10:48 +01:00
Antonio Scandurra
1e04411066 Don't focus query editor if there are matches on tab switch 2022-02-25 17:23:03 +01:00
Antonio Scandurra
b506db7c93 Use the new split pane's navigation history when cloning an item 2022-02-25 17:22:30 +01:00
Antonio Scandurra
88bfe5acb0 Allow splitting project find and maintain the searches in sync 2022-02-25 16:20:02 +01:00
Antonio Scandurra
29e035a70d Don't report a buffer when it doesn't contain any matches 2022-02-25 15:40:19 +01:00
Antonio Scandurra
2611b5449f Always sync before clearing or removing excerpts from MultiBuffer
We don't have any test that proves this is needed but seems good nonetheless.
2022-02-25 15:36:43 +01:00
Antonio Scandurra
ff0fa0e0bd Gracefully handle passing an empty set of ranges to push_excerpts 2022-02-25 15:36:16 +01:00
Antonio Scandurra
f649074d36 Refine project find's UX
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-25 15:27:34 +01:00
Nathan Sobo
51c645f6b4 Toggle focus between query editor and results on cmd-shift-F 2022-02-25 05:04:45 -07:00
Antonio Scandurra
2147db9b41 Open searched buffers in parallel 2022-02-25 12:29:50 +01:00
Antonio Scandurra
5be93044f6 Focus results editor when project find matches are updated 2022-02-25 12:17:25 +01:00
Antonio Scandurra
561123d6de Avoid extra smol::channel when iterating through snapshot paths 2022-02-25 11:49:33 +01:00
Antonio Scandurra
6a0cca7178 Add a fast path for when the search query is empty 2022-02-25 10:58:45 +01:00
Antonio Scandurra
a077210873 Focus query editor when deploying project-find 2022-02-25 10:58:32 +01:00
Antonio Scandurra
7aacb63762 Respect field editor background, color and selection styling 2022-02-25 10:48:22 +01:00
Antonio Scandurra
0bf944e038 Use Project::search in ProjectFind and show search results 2022-02-25 10:32:45 +01:00
Max Brunsfeld
5644336df3 Merge branch 'main' into project-find 2022-02-24 17:22:09 -08:00
Max Brunsfeld
fb1103e26d
Merge pull request #482 from zed-industries/c-support
Add C support with clangd
2022-02-24 17:16:55 -08: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
Antonio Scandurra
6d9b003634 WIP: Start sketching in ProjectFindView
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-24 19:07:00 +01:00
Antonio Scandurra
e83d1fc9fc Start on a regex implementation of SearchQuery 2022-02-24 16:33:31 +01:00
Antonio Scandurra
76cc9b347e Extract a search module 2022-02-24 15:55:13 +01:00
Antonio Scandurra
6a323ce2dd Implement a basic project-wide search using Aho-Corasick 2022-02-24 15:33:56 +01:00
Antonio Scandurra
26f7f4f5b2 WIP: Remove ripgrep and start matching query for paths ourselves 2022-02-24 12:33:28 +01:00
Antonio Scandurra
119bfaa99f WIP 2022-02-24 11:57:53 +01:00
Antonio Scandurra
fed6f708c0 Start on project-wide find 2022-02-24 11:57:53 +01:00
Antonio Scandurra
d929819c33 Fix warning 2022-02-24 09:52:25 +01:00
Antonio Scandurra
8fa23c702c Store ops if buffer handle can't be upgraded and buffer requests are in-flight 2022-02-24 09:32:31 +01:00
Max Brunsfeld
a6613d5345 Store operations for unknown buffers when there are outstanding buffer RPC requests 2022-02-23 20:35:05 -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
51e2e9e68d Make client log message format more consistent 2022-02-23 18:18:52 -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
e714b00c26 Improve logging around handling RPC requests on client 2022-02-23 15:37:51 -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
Nathan Sobo
73fcebb8b2 Bump protocol version 2022-02-23 06:33:31 -07:00
Nathan Sobo
9841abf402 v0.17.0 2022-02-23 06:26:45 -07:00
Max Brunsfeld
a14d0582ca Add C support with clangd 2022-02-22 17:21:21 -08: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
6be4b1ef6a Don't select entire item when jumping to a project symbol
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-22 12:56:43 -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
669fe775df Normalize paths passed to the FakeFs
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-22 12:43:56 -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
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
d7db3791d5 Show worktree root name for symbol when there are multiple worktrees
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-22 18:57:41 +01: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
326f1f43fe Syntax-highlight symbols based on their kind 2022-02-22 12:00:16 +01:00
Antonio Scandurra
d59ebb554b Update symbol matches as the query changes 2022-02-22 10:54:25 +01:00
Antonio Scandurra
8a8ae0fbcd Rename CompletionLabel to CodeLabel and add Project::symbols
This only works locally for now and we haven't implemented the
`RustLsp::label_for_symbol` method yet.
2022-02-22 10:01:08 +01:00
Antonio Scandurra
8f375a5026 Start on a new project_symbols crate 2022-02-22 08:42:12 +01:00
Nathan Sobo
618f0a127a Don't insert input in editor when control keys are pressed 2022-02-21 18:21:27 -07:00
Nathan Sobo
7cd5dbd2a8 v0.16.0 2022-02-21 18:10:10 -07:00
Nathan Sobo
c752383042
Merge pull request #459 from zed-industries/spurious-macro-errors
Download language servers dynamically on startup
2022-02-21 17:08:50 -08:00
Nathan Sobo
99594333a5 Log an error instead of panicking when there's no LSP download dir 2022-02-21 17:44:00 -07:00
Max Brunsfeld
03ec6e11b7 Assign language server download directory on startup
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 16:23:38 -08:00