Commit graph

463 commits

Author SHA1 Message Date
Julia
3655a96e54 Merge branch 'main' into unborked-git-zed2-diagnostics-view 2023-11-17 16:32:35 -05:00
Julia
c6d22af416 Get diagnostic2 tests building and running 2023-11-17 16:32:35 -05:00
Julia
a464a7da2a Merge branch 'main' into unborked-git-zed2-diagnostics-view 2023-11-17 16:32:35 -05:00
Julia
f4eb219c75 Get diagnostics view almost building in the zed2 world
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-11-17 16:32:35 -05:00
Mikayla
1693718637
Merge branch 'main' into saving-2 2023-11-16 23:11:38 -08:00
Mikayla
9a3cd073c7
Restore a bunch of random workspace stuff 2023-11-16 23:05:28 -08:00
Nathan Sobo
2fb13cf1ca
Separate WrappedLines from ShapedLines (#3350)
ShapedLines are never wrapped, whereas WrappedLines are optionally
wrapped if they are associated with a wrap width. Originally, when
rewriting GPUI, I tried to combine everything because wrapping is
inherently optional for the Text element, but we have a bunch of APIs
that don't make sense on a line that may wrap, so we need a distinct
type for that case.

This is a precursor to implementing clickable links in markdown. I
noticed multiple places where we were confused about whether or not the
line was wrapped so this felt important.

Release Notes:

- N/A
2023-11-16 23:20:35 -07:00
Nathan Sobo
9558da8681 Separate WrappedLines from ShapedLines
ShapedLines are never wrapped, whereas WrappedLines are optionally wrapped if
they are associated with a wrap width. I tried to combine everything because
wrapping is inherently optional for the Text element, but we have a bunch of
APIs that don't make sense on a line that may wrap, so we need a distinct type
for that case.
2023-11-16 23:10:51 -07:00
Conrad Irwin
2d1d75f482 +ManagedView
And some games with rust traits
2023-11-16 23:02:10 -07:00
Conrad Irwin
6d4276ea5f Merge branch 'main' into collab_ui2 2023-11-16 22:08:42 -07:00
Conrad Irwin
c0ad15756c More attachment configuration for context menus 2023-11-16 21:59:23 -07:00
Max Brunsfeld
e67c44a562
Fix file-reloading race condition (#3348)
### Summary

This PR fixes a bug that @as-cii and @osiewicz saw when the on-disk
contents of files changed due to running `git checkout` at the command
line. It caused a buffer's contents to diverge from the file's on disk
contents, but the buffer to show an *unmodified* status.

I've also introduced new APIs on gpui's deterministic executor, which
make it possible to write a test that reliably triggered the bug.

### Details

The bug is triggered by the following sequence of events:
1. A buffer's file changes on disk while the buffer is *unmodified*
2. Zed reloads the new content of the file
3. Before updating the buffer itself, Zed computes a *diff* between the
buffer's current contents, and the newly-loaded contents
4. While this diff is being computed, one of two things happens:
     1. the buffer changes on-disk *again*.
2. the user edits the buffer, but undoes the edit, so that the buffer
returns to an unmodified state

The bug itself was caused by a few things:
* The buffer diffing algorithm is pretty slow, because we perform a
character-wise diff
* We previously allowed multiple reload tasks to run concurrently
* When discarding an out-of-date diff, we failed to update parts of the
buffer's state (`saved_fingerprint`) which allow us to recognize that
the buffer's content differs from the file.

It was also difficult to reproduce the problem in tests, because under
deterministic execution, because it was extremely unlikely for other
tasks to make progress *after* a file had been reloaded, but *before*
the disk task has resolved. To help with testing, I introduced a pair of
executor APIs:

`spawn_labeled`, - for spawning a background task with a given *label*
`deprioritize_task` - for forcing tasks with a given label to run
*after* all other concurrent tasks.

I also made the `Model::next_event` test helper method more useful, in
that it no longer runs *until* parked in order to wait for the next
event to occur. It just steps the executor one poll at a time until the
model emits an event.

Release Notes:

- Fixed a bug that caused buffers to report incorrect modified/conflict
status when their buffers changed on disk multiple times in rapid
succession.
2023-11-16 20:19:16 -08:00
Max Brunsfeld
32979f3aca Rename deprioritize_task -> deprioritize
It applies to a family of tasks, not a task.
2023-11-16 20:03:18 -08:00
Max Brunsfeld
f3b6719c76 Rename both PlatformDispatcher::poll and Executor::run_step to 'tick'
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2023-11-16 19:58:26 -08:00
Conrad Irwin
9547e88d88 TEMP 2023-11-16 19:50:31 -07:00
Mikayla
432572c592
#RemoveThe2 2023-11-16 18:04:35 -08:00
Mikayla
4de2c0f7ef
Re-implement actions as derive macros instead of blanket impls 2023-11-16 17:32:02 -08:00
Conrad Irwin
074a221e0f Progress on ContextMenu 2023-11-16 16:59:27 -07:00
Max Brunsfeld
f9650b3111 Don't run until all the way until parked when waiting for a model's next event 2023-11-16 15:54:00 -08:00
Max Brunsfeld
6397c05835 Add the ability to deprioritize specific labeled tasks in tests 2023-11-16 15:54:00 -08:00
Conrad Irwin
9456f716c2 Only send one right click event 2023-11-16 15:30:53 -07:00
Conrad Irwin
267e07472d Checkpoint, MenuHandle can open one 2023-11-16 13:32:19 -07:00
Mikayla
a0e976599c
Salvage old distributed slice code 2023-11-16 10:32:55 -08:00
Conrad Irwin
d782426491 Dismiss tooltips on click 2023-11-16 10:26:09 -07:00
Kirill Bulatov
fd61683c46 WIP 2023-11-16 10:40:02 +02:00
Kirill Bulatov
61d6cb880c Start porting terminal_element to gpui2
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-11-16 10:04:03 +02:00
Mikayla
9da0b78ead
Merge branch 'main' into tabs-n-splits 2023-11-15 23:41:25 -08:00
Conrad Irwin
74afa62a55 Add Overlay component to gpui2 2023-11-15 23:00:36 -07:00
Conrad Irwin
8c14a8fa95 Merge branch 'main' into collab_ui2 2023-11-15 21:04:47 -07:00
Conrad Irwin
0a9fb3978b Enable panel switching 2023-11-15 21:01:00 -07:00
Nathan Sobo
e5ada92b7b
Remove initialize from the Element trait (#3338)
Initially, we imagined registering keyboard handlers in the initialize
phase so we would understand the relationships between focus handles
during the layout pass, which would allow us to assign assign `focus_in`
styles that impact layout.

However, we soon realized that many elements aren't created until paint
time anyway, such as within the uniform list. Since it's impossible to
know prior to paint whether an element contains the focused element, it
makes more sense to eliminate the `focus_in` styling helper.

Release Notes:

- N/A
2023-11-15 19:36:35 -07:00
Mikayla
78cea69172
Add focusable view and restore workspace deserialization. Partially restore split and tab functions 2023-11-15 16:36:43 -08:00
Mikayla
faf93aed4e
checkpoint 2023-11-15 14:17:04 -08:00
Nathan Sobo
4f09633379 Remove focus_in styling helper 2023-11-15 14:17:49 -07:00
Nathan Sobo
c6b374ebc9 Remove initialize method from Element trait 2023-11-15 14:11:19 -07:00
Conrad Irwin
0a51784dd0 Leaky, but better, test abstraction 2023-11-15 14:01:10 -07:00
Conrad Irwin
19c0b390d2
FileFinder tests (#3336)
Also including:
* Fixes for focus when closing the last item in a pane
* Workspace#active_item_as::<Editor>()
* cx.simulate_input()

Release Notes:

- N/A
2023-11-15 13:24:34 -07:00
Conrad Irwin
cebc8428c8 FileFinder tests 2023-11-15 13:16:28 -07:00
Antonio Scandurra
33a808a49b WIP 2023-11-15 20:41:09 +01:00
Antonio Scandurra
759ce7440c Avoid unnecessary call to with_element_id in RenderViewWith
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-11-15 20:12:30 +01:00
Antonio Scandurra
1d04dc5dbf Clear the state of keystroke matchers when focus changes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-11-15 20:11:07 +01:00
Antonio Scandurra
3978d4e872
Show fold indicators (#3334)
Release Notes:

- N/A
2023-11-15 20:10:24 +01:00
Antonio Scandurra
c225a3e5af Don't use Mutex or Arc now that app state is not Send
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-11-15 18:50:34 +01:00
Antonio Scandurra
c7b7f7dfd5 Move render_view into View::render_with
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-11-15 18:50:09 +01:00
Antonio Scandurra
17b8e4a684 Handle clicking folded ranges
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-11-15 18:19:26 +01:00
Antonio Scandurra
3ff8c78b58 Return a Fold struct when querying the FoldMap
This contains a new `id` field that lets us distinguish among folds.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-11-15 17:09:59 +01:00
Conrad Irwin
1db4fab3ab
Add command palette tests and simulate_keystrokes (#3330)
Release Notes:

- N/A
2023-11-15 08:00:41 -07:00
Antonio Scandurra
786cc59d7a Fix formatting 2023-11-15 11:07:32 +01:00
Antonio Scandurra
feeb44c122 Merge remote-tracking branch 'origin/main' into editor2-rename
# Conflicts:
#	crates/editor2/src/editor.rs
#	crates/editor2/src/element.rs
#	crates/gpui2/src/style.rs
2023-11-15 09:51:33 +01:00
Antonio Scandurra
c3094b7c3d Introduce gpui::render_view 2023-11-15 09:45:23 +01:00