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
Max Brunsfeld
5ada39c46c
Adjust multibuffer history test to reflect new behavior
2022-02-11 16:55:00 -08:00
Max Brunsfeld
72b1aafb63
Inline MultiBuffer::format
...
Put all the logic in Editor. Add an `all_buffers` method so the editor can
format all of the buffers by itself.
2022-02-11 16:22:19 -08:00
a3dba97dd5
Make multibuffer anchor's buffer_id optional
...
Avoid using 0 for a buffer id on Anchor::min and max
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-02-11 09:51:47 -08:00
Antonio Scandurra and Nathan Sobo
1a3adbe7ef
Don't return error when definition, completions, etc. are unavailable
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-02-11 13:16:17 +01:00
Antonio Scandurra
e035758ba9
Move Buffer::format to Project::format
2022-02-11 12:07:46 +01:00
39baa4d0a3
Don't open a multibuffer when code actions's edits are contained in the current editor
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-02-10 09:55:21 -08:00
Nathan Sobo and Antonio 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 Sobo and Antonio Scandurra
e91523b69d
Store the oldest transaction id for each excerpted buffer in multi-buffer transactions
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2022-02-10 09:14:39 -07:00
Nathan Sobo and Antonio 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
Antonio Scandurra
e7d5529a18
Push transaction into multi-buffer to allow undoing of a code action
2022-02-10 09:55:03 +01:00
Antonio Scandurra
310d43618b
Allow editor to be saved when in multi-buffer mode
...
Also, this commit enables the customization of the title in a multi-buffer.
When specified, it will take precedence over a filename (or "untitled").
2022-02-10 09:35:19 +01:00
Antonio Scandurra
59c879119d
Fix push_excerpts_with_context_lines when ranges overlap
2022-02-10 09:06:11 +01:00
Max Brunsfeld
3daba385eb
Start work on MultiBuffer::push_excerpts_with_context_lines
...
Use it in Editor::confirm_code_action
2022-02-09 18:28:15 -08:00
Max Brunsfeld and Nathan Sobo
db9b19b1be
Allow inserting multiple excerpts in a batch
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-02-09 17:56:06 -08:00
Max Brunsfeld and Nathan Sobo
689e2af025
Remove ExcerptProperties struct
...
Pass buffer and range as separate parameters
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-02-09 17:52:17 -08:00
bf162aee31
Fix BlockMap's handling of trailing empty excerpt updates with other edits
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-02-09 11:54:59 -08:00
d81cbf2d48
Add/remove excerpts in BlockMap randomized tests and fix resulting errors
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
Co-Authored-By: Max Brunsfeld <max@zed.dev >
2022-02-09 19:10:13 +01:00
Antonio Scandurra and Nathan Sobo
fd87085e7d
Fix randomized test failures on BlockMap with excerpt headers
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-02-09 15:17:40 +01:00
Antonio Scandurra
92e91cbf1f
WIP: Make editor crate compile again
...
Tests are still failing though.
2022-02-09 11:09:11 +01:00
Max Brunsfeld and Nathan Sobo
ad17a0bba6
WIP - Add excerpt headers as a built-in feature of BlockMap
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-02-08 18:15:45 -08:00
Max Brunsfeld
08061504d4
Consolidate logic for completion alongside code actions in Project
...
This way, completions are dealt with more consistently with code actions,
and the logic is not spread across so many places. The `language::File`
trait and the multibuffer no longer need to deal with completions. Completions
are no longer generic over an anchor type.
2022-02-08 14:24:45 -08:00
Max Brunsfeld
e3e21f9b4c
Consolidate all code actions logic into Project
2022-02-08 13:17:57 -08:00
Antonio Scandurra and Nathan 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
1ae79902e9
WIP: Start on applying code actions
2022-02-07 12:20:03 +01:00
Max Brunsfeld and Nathan Sobo
c0e51a467e
Start work on code actions
...
Just print out the returned code actions for now
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-02-04 17:45:00 -08:00
Max Brunsfeld and Nathan 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
ad472ca67d
Remove unused bytes_at method
2022-02-04 12:07:30 +01:00
Max Brunsfeld
e4e708a8bc
Add integration test for getting and resolving completions
2022-02-03 15:24:16 -08:00
cb37c266d3
Support multi-cursor autocompletion
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
Co-Authored-By: Max Brunsfeld <max@zed.dev >
2022-02-03 18:58:36 +01:00
Antonio Scandurra
b72e086faa
Optimize summaries_for_anchors when MultiBuffer is a singleton
2022-02-03 11:22:55 +01:00
Antonio Scandurra
6293058b27
Opt into language-aware features when getting buffer chunks
...
We use chunks a lot to transform points and sync the various display maps,
and always querying tree-sitter or the LSP diagnostics in those cases is
unnecessarily expensive.
2022-02-03 11:21:30 +01:00
Max Brunsfeld
90404114e3
Remove theme parameters from buffer/display map's chunks methods
...
Change Chunks to contain highlight ids instead of actual highlight
styles. Retrieve the actual highlight style from the theme in the
editor element layer.
This is to set us up to perform syntax highlighting in other code
paths where the theme is not available.
2022-02-02 16:33:04 -08:00
0b7628d3c9
Improve formatting of function autocompletion labels in Rust
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
Co-Authored-By: Max Brunsfeld <max@zed.dev >
2022-02-02 18:43:55 +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
a68c127491
Broadcast completion triggers to remote participants
2022-02-02 14:07:41 +01:00
Max Brunsfeld
067eb8740c
Start work on handling snippet completions
2022-02-01 15:35:02 -08:00
Max Brunsfeld
0323952bfb
🎨 Return an option task from confirm_completion
2022-02-01 14:27:01 -08:00
Antonio Scandurra and Nathan Sobo
e354b91d22
Apply additional edits when confirming a completion
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-02-01 17:38:11 +01:00
Antonio Scandurra and Nathan Sobo
e150081fa1
Filter and sort suggestions in autocomplete
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-02-01 15:11:20 +01:00
Nathan Sobo
4d0cfe5bec
Create anchors with latest snapshot when completions are ready
...
Using the previous snapshot was panicking.
2022-01-31 18:33:25 -07:00
Max Brunsfeld and Nathan Sobo
267b719dbc
Trigger completion when typing words or trigger characters
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-01-31 17:07:24 -08:00
Max Brunsfeld and Nathan Sobo
c876da9601
Insert completion text on enter
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2022-01-31 13:46:50 -08:00
Antonio Scandurra
c80716473a
WIP
2022-01-31 19:12:35 +01:00
Antonio Scandurra
c7cf722140
Merge pull request #378 from zed-industries/multibuffer-anchors
...
Fix errors when anchors escape an excerpt's buffer boundaries
2022-01-31 14:28:41 +01:00
Antonio Scandurra
06faec5348
📝 Improve assertion comment
2022-01-29 10:41:55 +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 Scandurra
009e45df15
Prevent anchors from escaping their excerpt's range when resolving them
...
This could happen if an anchor was created on an excerpt with a larger range.
Then, if the excerpt was removed and added back at the same position and with
the same buffer but a smaller range, resolving the anchor could overshoot
the excerpt's boundaries.
2022-01-29 09:52:38 +01:00
Antonio Scandurra
ccda42e148
Optimize some common operations when MultiBuffer is a singleton
2022-01-28 11:50:13 +01:00