Commit Graph
102 Commits
Author SHA1 Message Date
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 BrunsfeldandNathan 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 BrunsfeldandNathan 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
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 b7b59c94fa WIP: Start on a GoToDefinition action for the editor 2022-01-20 12:26:04 +01:00
Antonio Scandurra ef78225a5d Return a Task<Result<()>> in {ItemView,Buffer,MultiBuffer}::save 2022-01-20 09:58:24 +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
499671b2c3 Match on names only when outline query has no spaces
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-14 09:16:29 -08:00
Antonio Scandurra 4956298db4 Allow matching of context items in outline view 2022-01-14 11:09:02 +01:00
Max Brunsfeld 3dd4c39edd Incorporate syntax highlighting into symbol outline view
Still need to figure out how to style the fuzzy match characters
now that there's syntax highlighting. Right now, they are
underlined in red.
2022-01-13 18:10:02 -08:00
Max Brunsfeld 09cc3bd94d Include highlighting runs in Outline 2022-01-13 14:46:15 -08:00
Max Brunsfeld a1a9c9356d Allow multiple disjoint nodes to be captured as matcheable in the outline query 2022-01-13 14:04:25 -08:00
Antonio ScandurraandMax Brunsfeld fad016d316 Return Outline<Anchor> from MultiBuffer::outline
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-13 18:24:00 +01:00
Max BrunsfeldandNathan Sobo 72a4ddd689 Add Buffer::outline method
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:17:49 -08:00
Antonio ScandurraandNathan Sobo f883ffb4f2 Implement Buffer::format
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:01:20 +01:00
Antonio Scandurra 8b13462bce Process selection anchors in a sorted fashion when refreshing them 2022-01-12 09:28:09 +01:00
Antonio ScandurraandNathan Sobo d9a870ee21 Ensure selections stay sorted after refreshing them
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-11 17:16:45 +01:00
Antonio ScandurraandNathan Sobo 848016e6b3 Verify Anchor::buffer_id before resolving it or comparing it
This commit also verifies some properties about anchor resolution in the
multibuffer randomized test.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-11 16:40:12 +01:00
Max Brunsfeld dfab726dd9 When selections lose their excerpts, move them to the next primary diagnostic 2022-01-07 14:53:33 -08:00
Max BrunsfeldandNathan Sobo 4ca8d56b7f Finish implementing ProjectDiagnostics::open_excerpts
* Build workspace item views with a reference to the workspace
* Add randomized test for MultiBuffer::excerpted_buffers and fix a small bug

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-07 09:59:27 -08:00
Antonio ScandurraandNathan Sobo 7ebeddd2c2 WIP: Add keybinding to open buffers under cursors
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-07 16:12:50 +01:00
Antonio Scandurra 8ed2231de0 Clear selections on other excerpted buffers when setting active selections 2022-01-07 10:19:28 +01:00
Nathan SoboandMax Brunsfeld df5b181ad8 Send diagnostic summaries to guests when they join the project
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-06 12:12:09 -07:00
Max Brunsfeld f2273252b1 WIP - MultiBuffer::refresh_anchors 2022-01-05 21:12:49 -08:00
Max Brunsfeld 4535c2e99d Merge branch 'main' into polish-project-diagnostics 2022-01-05 20:38:20 -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 ScandurraandMax Brunsfeld 7525741533 Merge branch 'main' into polish-project-diagnostics
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-04 18:35:28 +01:00
Antonio Scandurra dd5ba61ab6 Rip out "diagnostic providers" 2022-01-04 16:32:17 +01:00
Antonio Scandurra 9e9eb32e5d Capture a new buffer snapshot for excerpts whose selections got updated 2022-01-04 12:22:51 +01:00
Max BrunsfeldandNathan Sobo 9838df770f Add MultiBufferSnapshot::range_contains_excerpt_boundary
Use this method to disable move_line_down across excerpt boundaries.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-27 17:08:31 -08:00
Antonio Scandurra ae276700d6 Implement Buffer::diagnostic_group 2021-12-24 12:08:55 +01:00
Antonio Scandurra 85d495aa33 Remove BufferState when the last buffer's excerpt is removed 2021-12-23 09:59:39 +01:00
Max Brunsfeld 401791cc75 Fix remove_excerpts when removing the last N excerpts, N > 1
Also, generalize the randomized test to remove multiple excerpts at a time
2021-12-22 21:02:20 -08:00
Max Brunsfeld 8c37f7c519 Implement MultiBuffer::insert_excerpt_after 2021-12-22 17:59:44 -08:00
Max Brunsfeld 4be5dcff9e Remove unused multi_buffer::FromAnchor trait 2021-12-22 13:27:43 -08:00
Max Brunsfeld 1491cc23d3 Revert "Implement MultiBuffer::remove_excerpts by inserting tombstones"
This reverts commit d1b15cd060.
2021-12-22 10:18:33 -08:00
Antonio Scandurra d1b15cd060 Implement MultiBuffer::remove_excerpts by inserting tombstones
This will make it easier to use anchors in the presence of deletes.
2021-12-22 17:57:36 +01:00
Max Brunsfeld 7790112f4b Implement MultiBuffer::remove_excerpts
We'll need this for updating project diagnostics
2021-12-21 15:25:57 -08:00
Max Brunsfeld 11a46e978b Avoid repeated subscriptions + clones when adding another excerpt for same buffer 2021-12-21 14:28:23 -08:00
Max Brunsfeld a61bb80ccd Fix maintenance of MultiBuffer's buffer states 2021-12-21 13:07:43 -08:00
Max Brunsfeld 5884a78267 Index max buffer row on MultiBuffer 2021-12-21 12:36:46 -08:00
Max Brunsfeld 3bf003a6cc Remove header heights from multibuffer randomized test 2021-12-21 10:24:01 -08:00
Antonio ScandurraandMax Brunsfeld c122723122 Render excerpt headers using DisplayMap::insert_blocks
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-21 18:32:27 +01:00