Commit Graph

205 Commits

Author SHA1 Message Date
Antonio Scandurra
5d5f89231b Hold strong handle in ChildView
This eliminates a whole class of errors where the `ChildView` could
be referring to a view that doesn't exist anymore. That probably still
indicates that there's an underlying bug, but at least we won't panic.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-14 15:49:11 +01:00
Antonio Scandurra
47b40e3839 Don't draw scene elements if their size is zero
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-14 15:29:18 +01:00
Antonio Scandurra
1e9b6b050d
Merge pull request #596 from zed-industries/fix/dropped-subscription-in-callback
Fix Dropped Subscription in Handler Bug
2022-03-12 19:14:38 +01:00
Keith Simmons
c50be72214 Format including missing formatting changes from previous PR 2022-03-11 15:38:01 -08:00
Keith Simmons
16afb3d5b1 Add some tests for global events and fix potential bug in subscriptions when subscription is dropped inside of it's own callback
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-11 15:34:04 -08:00
Nathan Sobo
951fd1ab36 Merge branch 'main' into select-on-rename 2022-03-11 15:30:07 -07:00
Keith Simmons
87b1cfe34f
Merge pull request #576 from zed-industries/cursor-shape
Add support for rendering the cursor as a Block and Underscore

Co-authored-by: Max Brunsfeld <max@zed.dev>
2022-03-11 11:51:24 -08:00
Keith Simmons
144591d639 Minor renames for clarity 2022-03-11 11:25:36 -08:00
Keith Simmons
81fc812221 Add global events to MutableAppContext and raise global event when new workspace is created 2022-03-10 20:03:01 -08:00
Keith Simmons
b62daebde1
Merge pull request #563 from zed-industries/mouse-history-navigation
Add missing mouse button events and mouse history navigation
2022-03-10 17:39:36 -08: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
Nathan Sobo
3968b37e26 When renaming, fade out the old name and select all 2022-03-10 14:55:31 -07: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
Nathan Sobo
ac1eb19f83 Start on text highlight support 2022-03-09 20:51:35 -07: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
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
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
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
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
Nathan Sobo
40c0b9e7a5 Halt keystroke dispatch when a global action is dispatched 2022-03-06 09:46:33 -07:00
Max Brunsfeld
4124308d94 Fix errors from conditional compilation in timer functions 2022-03-04 17:16:17 -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
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
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
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
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
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
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
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
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
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
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
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
618f0a127a Don't insert input in editor when control keys are pressed 2022-02-21 18:21:27 -07:00
Antonio Scandurra
38e4ec9157 Replace Inconsolata with Zed Mono and Zed Sans 2022-02-18 14:55:11 +01:00
Max Brunsfeld
10580f96a3 Automatically include current view id in element state ids 2022-02-17 13:44:46 -08: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
Antonio Scandurra
7c5a5c4ad4 Print the correct seed on randomized test failure 2022-02-16 16:29:45 +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
Max Brunsfeld
1ca1595490 Add AnyWeakModelHandle
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-15 17:56:50 -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
c33d554675 Don't render sample item twice in UniformList 2022-02-15 12:02:58 +01:00
Max Brunsfeld
ddc1f237a6 Panic if element state is used twice in the same frame
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-14 14:04:27 -08:00
Antonio Scandurra
1eea2f3653 Add integration test for code actions 2022-02-14 11:42:56 +01:00
Antonio Scandurra
5a7d391d73 Ensure response barrier is always dropped, even if request is canceled 2022-02-12 10:23:50 +01:00
Antonio Scandurra
2fcdcac080 Fetch code actions on cursor movement instead of on-demand
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 14:41:19 +01:00
Max Brunsfeld
e0fe8b5a7c Merge branch 'main' into assists 2022-02-08 12:41:57 -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
Nathan Sobo
dc20be256e Start on code action confirmation 2022-02-05 12:37:34 -07:00
Max Brunsfeld
16acbd2123 Handle appkit's cancelOperation: message to allow binding cmd-. 2022-02-04 17:33:09 -08:00
Antonio Scandurra
625beaaa9b Finish writing test for the new autocompletion behavior
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 15:47:19 +01:00
Antonio Scandurra
ae5aebf405 Fix flaky test_highlighted_ranges due to random TypeId ordering 2022-02-02 10:09:12 +01:00
Antonio Scandurra
b89a39bcb3 Filter and sort suggestions in autocomplete
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-01 15:11:20 +01:00
Max Brunsfeld
c19d639e0a Derive autocomplete menu's width from the width of its largest item
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:01:20 -08:00
Nathan Sobo
960696a504 Bind autocomplete to ctrl-space
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-31 11:34:19 -07:00
Antonio Scandurra
5c862bfe98 Maintain search results as query and active editor changes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-28 15:19:58 +01:00
Antonio Scandurra
e7d4c385d5 Take an Into<AnyViewHandle> in ChildView::new
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-27 17:54:45 +01: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
Antonio Scandurra
51c34ebcc2 Alpha-blend borders with backgrounds in quad SDF
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-26 19:16:26 +01:00
Antonio Scandurra
dedd5d63fb Fix blending of quad's border with background
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 17:06:20 +01:00
Antonio Scandurra
3f6960bd34 Position underlines at a distance proportional to the line descent
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 16:03:06 +01:00
Antonio Scandurra
b9b255652f Display squiggly underlines underneath text with diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 15:52:40 +01:00
Antonio Scandurra
52594fe250 WIP: Start on squiggly underlines 2022-01-26 13:07:39 +01:00
Max Brunsfeld
78b57e4d9d Scale diagnostic header and message text with editor font
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-25 12:10:11 -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
Nathan Sobo
469ee554a0 Get most tests passing when respecting wake order for foreground tasks in Deterministic executor
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-24 17:13:56 -07:00
Antonio Scandurra
b7314ef2aa WIP: Start restructuring executor 2022-01-24 18:49:20 +01:00
Antonio Scandurra
93125cbd16 Remove executor::Foreground::Test
All code paths have already transitioned to `Foreground::Deterministic`.
2022-01-24 16:14:30 +01:00
Nathan Sobo
b755b2d602 Add ViewHandle::defer
It's like update, but happens after the current effect instead of synchronously. Also, it doesn't allow the callback to return a value because there would be nothing to do with it.
2022-01-22 13:21:59 -07:00
Nathan Sobo
8b04c5d3ac Add a ViewContext::defer
This takes a closure that will be enqueued as an effect to ensure there are no entities on the stack.
2022-01-22 13:14:25 -07:00
Max Brunsfeld
f1fc0bde99 Flush effects after every spawned future completes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-21 17:43:24 -08:00
Nathan Sobo
19751e9200 Merge remote-tracking branch 'origin/main' into go-to-definition 2022-01-21 11:12:38 -07:00
Antonio Scandurra
e5662dd426 Allow observing the release of entities
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-21 14:34:14 +01:00
Nathan Sobo
fbca28337a When opening a path in an existing window, move it to the foreground 2022-01-20 20:45:30 -07:00
Antonio Scandurra
634340dd84 Return a task from Workspace::save_active_item
This required changing our approach to OS prompts and this commit greatly
simplifies that. We now avoid passing a callback and return a simple future
instead. This lets callers spawn tasks to handle those futures.
2022-01-20 09:51:29 +01:00
Max Brunsfeld
f3239fe1d5 Apply scroll_max after uniform list autoscrolls 2022-01-14 11:56:28 -08:00
Max Brunsfeld
dd8e5ee543 Add bottom margin to the outline view 2022-01-14 11:01:20 -08:00
Max Brunsfeld
b7561c6cef Add select_first and select_last bindings to outline view
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-14 10:45:37 -08:00