Antonio Scandurra
50a31721eb
Wait for version before returning completions
2022-02-17 11:41:19 +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
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
Antonio Scandurra
fadb94afb2
Use selection instead of just the cursor when fetching code actions
2022-02-14 14:13:36 +01:00
Nathan Sobo
93eb005f74
Correctly redo all undone edits after undoing in multi-buffer
...
When undoing edits performed in the multi-buffer, we also undo subsequent edits that may have occurred outside of the multi-buffer. This commit makes us redo those edits as well.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-10 09:26:20 -07:00
Nathan Sobo
9936bb2efa
Undo subsequent edits when undoing in multi-buffer
...
When undoing in the multi-buffer, don't preserve edits that occurred outside the multi-buffer after the edit being undone.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-10 09:04:53 -07:00
Max Brunsfeld
ca697e1bba
Add BufferSnapshot::edited_ranges_for_transaction
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 17:04:07 -08:00
Max Brunsfeld
e0fe8b5a7c
Merge branch 'main' into assists
2022-02-08 12:41:57 -08:00
Antonio Scandurra
7d8641afb6
Make transactions serializable to enable edits on behalf of other users
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-08 19:48:21 +01:00
Antonio Scandurra
624eb5907e
Serialize buffer in terms of operations rather than state
...
This is required because, after joining, we want to be able to refer
to operations that have happened prior to joining, which are not
captured by the state. There is probably a way of reconstructing operations
from the state, but that seems unnecessary and we've already talked about
wanting to have the server store operations rather than state once we start
persisting worktrees.
2022-02-08 14:59:46 +01:00
Antonio Scandurra
dca974c7d4
Apply code actions remotely
2022-02-08 12:18:14 +01: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
4900019e9b
Add a ToPointUtf16 trait in text and multibuffer
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 17:35:37 -08:00
Antonio Scandurra
924eb622ae
Wait for additional edits before pushing transaction in remote buffer
2022-02-02 17:01:23 +01:00
Antonio Scandurra
d765e75bad
Apply additional edits for completion when the buffer is remote
2022-02-02 16:29:13 +01:00
Antonio Scandurra
a284e7140c
Always return valid locations when refreshing anchors
...
Specifically, with this commit:
- We will now refresh the anchor if it escapes the boundaries of the excerpt by
using the `Excerpt::contains` method. This was not the case before, as we were
just checking if the excerpt id and buffer id of the anchors matched the ones
stored on the excerpt.
- We fixed a bug that was causing the anchor to be outside of the excerpt when
resetting it to one of the excerpt's endpoints after we couldn't keep its
position. This would happen because we were using `anchor_at`, which resolved
the anchor to an offset first and then converted it back into an anchor with
the given bias, which is a lossy operation. We now use `Anchor::bias` to
achieve the same goal: note that this could still lead to the anchor escaping
the excerpt's boundary when the bias doesn't match the endpoint's bias, so we
take extra care to avoid that and `min`/`max` the newly-produced anchor with
the other endpoint.
2022-01-29 10:10:53 +01:00
Antonio Scandurra
f055053fc9
Avoid grouping transactions created by different editors
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 15:51:46 +01:00
Antonio Scandurra
d5acbe1e32
Use offset to restore navigation position if anchor can't be resolved
2022-01-18 09:59:28 +01:00
Antonio Scandurra
310def2923
Implement Buffer::format
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:01:20 +01:00
Max Brunsfeld
fee7657fd7
Merge branch 'main' into polish-project-diagnostics
2022-01-05 20:38:20 -08:00
Max Brunsfeld
f9f75e98f8
Fix Locator::from_index
...
Enhance language::tests::test_random_collaborators so that it checks buffer invariants.
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-05 17:58:24 -08:00
Max Brunsfeld
e5faaeb2f2
Fix Global::gt
and rename it to changed_since
...
A false negative return value of `gt` was preventing guests' multibuffers from
syncing correctly.
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-05 17:36:12 -08:00
Max Brunsfeld
85a13fa477
Fix panic when resolving anchors after an excerpt id has been recycled
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-05 11:28:49 -08:00
Antonio Scandurra
bf044506ed
Verify that selections are replicated correctly in randomized test
2022-01-05 15:04:08 +01:00
Antonio Scandurra
870fa5f278
Serialize deferred operations
2022-01-05 11:52:41 +01:00
Antonio Scandurra
d383ff30ce
Introduce randomized test for collaboration on buffers
...
This test will exercise serialization of operations as well as peers
replicating from an existing buffer.
2022-01-05 11:51:41 +01:00
Antonio Scandurra
7bc8eb4f3d
Fix compile errors and get serialization unit test passing
2022-01-05 10:29:29 +01:00
Max Brunsfeld
984e366c32
WIP - Serialize buffer in terms of its state, not its base text + ops
...
The main reason for this is that we need to include information about
a buffer's UndoMap into its protobuf representation. But it's a bit
complex to correctly incorporate this information into the current
protobuf representation.
If we want to continue reusing `Buffer::apply_remote_edit` for
incorporating the historical operations, we need to either make
that method capable of incorporating already-undone edits, or
serialize the UndoMap into undo *operations*, so that we can apply
these undo operations after the fact when deserializing. But this is
not trivial, because an UndoOperation requires information about
the full offset ranges that were undone.
2022-01-04 18:06:16 -08:00
Nathan Sobo
7c9e4e513c
Provide an accurate panic message when translating points off the end of a line
...
Maybe we should fail more gracefully in this case, but I think we should at least make the message accurate and see how we do.
2021-12-29 23:11:54 -08:00
Antonio Scandurra
11e3874b4a
Remove duplication when assigning diagnostics and hardcode provider names
2021-12-24 12:07:26 +01:00
Max Brunsfeld
0faf5308ac
Add a unit test for preserving disk-based diagnostics
2021-12-22 13:27:43 -08:00
Max Brunsfeld
04d577e326
Fix context line handline in project diagnostic view
2021-12-21 11:46:47 -08:00
Antonio Scandurra
8534a9cc41
Don't insert headers in MultiBuffer
...
This lays the groundwork to insert headers in the block map instead.
2021-12-21 16:38:18 +01:00
Antonio Scandurra
64e2f6d506
Ensure BlockMap::clip_point
always yield a valid buffer location
2021-12-16 12:29:37 +01:00
Antonio Scandurra
1bdaeda43e
Remove disk diagnostics that were invalidated by a buffer edit
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-15 18:29:01 +01:00
Antonio Scandurra
4ab307f0a1
Re-enable multi-byte random character generation
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 17:51:11 +01:00
Antonio Scandurra
e23965e7c9
Implement MultiBuffer::reversed_chars_at
2021-12-15 10:06:45 +01:00
Antonio Scandurra
08e9f3e1e3
Maintain a different undo/redo stack in MultiBuffer
...
This only applies to singleton mode.
2021-12-14 17:43:41 +01:00
Antonio Scandurra
523cbe781b
Return the transaction id after grouping in end_transaction_at
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-14 17:41:42 +01:00
Antonio Scandurra
c984b39aaa
Show remote collaborators' active selections
2021-12-13 11:38:38 +01:00
Nathan Sobo
cdbcbdfe6d
Test undo/redo at editor layer, including selection restoration
2021-12-12 15:04:19 -07:00
Nathan Sobo
4dd0752e80
More messy progress towards selections in editors
2021-12-11 00:29:34 -07:00
Nathan Sobo
8432daef6a
WIP: Start on removing selections from buffer in favor of editor
2021-12-10 19:23:34 -07:00
Nathan Sobo
f35c419f43
Return optional transaction ids from undo/redo
...
This will allow the editor to restore selections that it associated with the start or end of a transaction.
2021-12-10 18:08:26 -07:00
Nathan Sobo
77defe6e28
Return optional transaction ids when starting/ending a transaction
...
If the transaction was nested, we return None. Otherwise we return the transaction id in preparation for editors to maintain their own selection state.
2021-12-10 18:00:09 -07:00
Antonio Scandurra
9c74deb9ec
Finish removing anchor collections from MultiBuffer
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-10 15:58:37 +01:00
Antonio Scandurra
d9da8effd4
Re-implement edits_since_in_range
in terms of Locator
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-10 14:22:43 +01:00
Antonio Scandurra
c8d5e19492
Merge branch 'fragment-locators' into project-diagnostics
2021-12-10 14:01:17 +01:00
Antonio Scandurra
eeba0993aa
Optimize anchor comparison and take full advantage of fragment IDs
2021-12-10 09:16:58 +01:00
Max Brunsfeld
5e516f59c0
Merge branch 'fragment-locators' into HEAD
2021-12-09 14:49:04 -08:00
Max Brunsfeld
1ed1ec21dd
Batch anchor resolution, avoid cloning fragment ids when seeking
2021-12-09 11:00:40 -08:00
Antonio Scandurra
e9c385e7a6
WIP
2021-12-09 18:27:54 +01:00
Antonio Scandurra
65711b2256
Remove anchor collections
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-09 17:28:27 +01:00
Antonio Scandurra
67686dd1c2
Don't use an enum for anchors and model min/max more implicitly
...
This will make it easier to serialize an anchor.
2021-12-09 12:01:17 +01:00
Antonio Scandurra
cbe136c0cb
Implement anchor resolution using locators
2021-12-09 11:18:01 +01:00
Antonio Scandurra
b7535dfba4
Store only clock::Local
in InsertionFragment
2021-12-09 09:21:52 +01:00
Antonio Scandurra
dc81b5f57a
Make remote edit randomized tests pass with locators
2021-12-09 09:15:19 +01:00
Antonio Scandurra
b4ebe179f9
Make local edit randomized tests pass with locators
2021-12-09 09:11:16 +01:00
Nathan Sobo
dd38eb1264
Start on maintaining an insertions tree
...
I'm correctly assigning fragment ids to all fragments in the fragments tree, but I have a randomized test failure when making sure that the insertions tree matches the state of the fragments tree.
2021-12-08 22:05:13 -07:00
Nathan Sobo
ec54010e3c
Sketch in type-level changes to track insertion splits
2021-12-08 21:04:22 -07:00
Nathan Sobo
98f726974e
WIP
2021-12-08 20:04:30 -07:00
Nathan Sobo
87d16c271e
Get Editor compiling with MultiBuffer as its buffer
...
There's a bunch of unimplemented methods in MultiBuffer, but everything compiles.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-08 19:23:04 -07:00
Max Brunsfeld
daedf179b2
Implement Anchor, AnchorRangeMap, SelectionSet in multi_buffer
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-08 12:56:09 -08:00
Max Brunsfeld
5f8e406c18
Fill out ExcerptList API
...
This restores the improvements that we had made on the `project-diagnostics-generic` branch.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-08 10:04:22 -08:00
Antonio Scandurra
a88cff4fa0
Remove lifetime parameter from TextDimension trait
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-12-08 09:45:57 -08:00
Max Brunsfeld
fa379885f1
Give more specific names to all snapshot and text iterator types
2021-12-08 09:24:00 -08:00
Max Brunsfeld
39cc0cac93
Fix Subscription re-export after moving it into its own module
2021-12-06 17:40:17 -08:00
Nathan Sobo
4578938ea1
Implement ExcerptList::subscribe
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 13:37:17 -07:00
Nathan Sobo
6965117dd8
Allow patches to be composed with edit iterators in addition to other Patches
...
This can avoid an extra allocation in some cases.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 13:00:51 -07:00
Antonio Scandurra
42eba7268d
Introduce Buffer::edits_since_in_range
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-06 19:48:45 +01:00
Antonio Scandurra
e37908cf3b
Start on a simple randomized test for FragmentList
2021-12-06 16:08:17 +01:00
Antonio Scandurra
45d6f5ab04
Start on maintaining edits in FragmentList
2021-12-06 12:10:25 +01:00
Nathan Sobo
811696670a
Start on a new FragmentList
...
Here I'm exploring a new approach to the project-wide diagnostics view that can exactly mirror the contents of cargo check. The `FragmentList` composes an arbitrary list of fragments from other buffers and presents them as if they were a single buffer.
2021-12-04 06:57:56 -07:00
Antonio Scandurra
733e0cb21b
Use the new buffer subscription API to keep DisplayMap
in sync
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-01 16:08:53 +01:00
Antonio Scandurra
3b536f153f
Introduce text::Buffer::subscribe
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-01 15:55:05 +01:00
Antonio Scandurra
b841b3eb79
Don't produce invalid intermediate edits in Patch::compose
2021-12-01 11:44:33 +01:00
Max Brunsfeld
faba276fdc
WIP - maintain foldmap with Buffer::edits_since
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-30 17:23:02 -08:00
Max Brunsfeld
924e1578ea
Use &Snapshot
directly instead of impl Into<Content<'a>>
...
The text::Buffer and its snapshot already used the same representation
for their content, so we can just make Buffer deref to a Snapshot.
2021-11-30 13:32:11 -08:00
Nathan Sobo
d3f28166cb
Rename buffer crate to text and name its entrypoint after the crate
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-30 12:26:12 -07:00