Commit Graph
350 Commits
Author SHA1 Message Date
Antonio Scandurra 5c3e450318 Introduce Patch::transform_old 2022-03-25 14:28:38 +01:00
Keith SimmonsandNathan Sobo 1eacdcf00a Remove result from anchor cmp functions
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 11:48:31 -07:00
e0d394eaf6 Change language::anchor::min() to a constant
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 10:41:33 -07:00
dcb6b335e7 Make rename highlights work across multibuffer excerpts
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 10:22:47 -07:00
Antonio Scandurra 2f1b1abbb8 Merge pull request #661 from zed-industries/follow
Introduce basic following experience
2022-03-23 15:17:44 +01:00
Keith Simmons 8d4deb8693 Add editor selection utilities
Also improved test that was failing during above to use marker text approach as a drive by
2022-03-22 16:08:22 -07:00
Antonio Scandurra d37930e006 Serialize initial follow state in leader and reflect it in follower 2022-03-18 10:22:13 +01:00
Antonio ScandurraandNathan Sobo 3217629af3 Don't seek FilterCursor upon creation
This lets us use `next` or `prev` to decide whether to park the cursor
at the first or last filtered item.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:13:23 +01:00
Antonio Scandurra c2c68cbfe9 Start on implementing filtering support for Cursor::prev 2022-03-15 15:13:23 +01:00
Nathan SoboandAntonio Scandurra c598628f94 Don't reuse excerpt ids in MultiBuffer
This prevents anchors from swapping their ordering, which was causing issues in FoldMap.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-11 08:50:50 -07:00
Nathan SoboandAntonio Scandurra 0db6f31d02 Remove dead code
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-11 08:24:42 -07:00
111d5305ea 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
Max BrunsfeldandNathan Sobo 3420f41715 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
Antonio Scandurra 8692e322a3 Use LSP range formatting when document formatting is not available 2022-03-04 10:13:17 +01:00
Antonio Scandurra 3ad7272559 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
Max Brunsfeld 3a1a9ecb45 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
b36faed34e 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 e18e172cda Move several buffer-related messages to the background 2022-03-03 12:18:19 +01:00
Antonio Scandurra f2d7451ca2 Use Project::search in ProjectFind and show search results 2022-02-25 10:32:45 +01:00
Antonio Scandurra 751ffccf60 Simplify undo_to_transaction and redo_to_transaction
We don't need to mutate the history anymore now that we render pending renames
with a block decoration.
2022-02-19 10:52:21 +01:00
Antonio Scandurra 7a72d7aed7 Undo temporary edits before performing rename or canceling it
Also, wire up remote renames.
2022-02-18 11:41:47 +01:00
Antonio Scandurra fac5959ac2 Wait for version before returning completions 2022-02-17 11:41:19 +01:00
Max BrunsfeldandNathan Sobo 258542b74a 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 BrunsfeldandNathan Sobo f508b135e1 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 22800b4f88 Use selection instead of just the cursor when fetching code actions 2022-02-14 14:13:36 +01:00
Nathan SoboandAntonio Scandurra 8632ae9bc1 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 SoboandAntonio Scandurra e8ed237265 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 BrunsfeldandNathan Sobo a926ad4f5d Add BufferSnapshot::edited_ranges_for_transaction
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 17:04:07 -08:00
Max Brunsfeld 1e18742c9d Merge branch 'main' into assists 2022-02-08 12:41:57 -08:00
Antonio ScandurraandNathan Sobo 9e40fdc3fc 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 cf043af1ff 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 943fb46052 Apply code actions remotely 2022-02-08 12:18:14 +01:00
Max BrunsfeldandNathan Sobo 656fee96e6 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 BrunsfeldandNathan Sobo e47c404bdd 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 b221c19b8e Wait for additional edits before pushing transaction in remote buffer 2022-02-02 17:01:23 +01:00
Antonio Scandurra b75f0e3ff3 Apply additional edits for completion when the buffer is remote 2022-02-02 16:29:13 +01:00
Antonio Scandurra b5da038bea 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 ScandurraandNathan Sobo e8ea29213f 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 f9ebc363a2 Use offset to restore navigation position if anchor can't be resolved 2022-01-18 09:59:28 +01:00
Antonio ScandurraandNathan Sobo f883ffb4f2 Implement Buffer::format
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:01:20 +01:00
Max Brunsfeld 4535c2e99d Merge branch 'main' into polish-project-diagnostics 2022-01-05 20:38:20 -08:00
Max BrunsfeldandNathan Sobo 4d4dc1b44a 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 BrunsfeldandNathan Sobo 75170a078f 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 BrunsfeldandNathan Sobo 75ac4f8925 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 2f15acde6f Verify that selections are replicated correctly in randomized test 2022-01-05 15:04:08 +01:00
Antonio Scandurra b41cb32d9d Serialize deferred operations 2022-01-05 11:52:41 +01:00
Antonio Scandurra 1450e009e7 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 5ca9efceea Fix compile errors and get serialization unit test passing 2022-01-05 10:29:29 +01:00
Max Brunsfeld 7a5db108f1 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 a7d84ee0ed 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