Commit Graph

553 Commits

Author SHA1 Message Date
Max Brunsfeld
439d12cb85 Start work on syntax highlighting completions 2022-02-02 18:14:30 -08:00
Max Brunsfeld
45898daf83 Fix hang in editor completion unit test 2022-02-02 17:09:36 -08:00
Max Brunsfeld
88adddb324 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
Antonio Scandurra
101add8da3 Hide completions when using the mouse
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-02 19:12:36 +01:00
Antonio Scandurra
8149bcbb13 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
8d7815456c Don't apply completion's edit when it wouldn't change the buffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-02 18:00:30 +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
91e5c2dfac Broadcast completion triggers to remote participants 2022-02-02 14:07:41 +01:00
Antonio Scandurra
ed549e352f Start on requesting completions for remote buffers 2022-02-02 12:22:47 +01:00
Antonio Scandurra
ae5aebf405 Fix flaky test_highlighted_ranges due to random TypeId ordering 2022-02-02 10:09:12 +01:00
Antonio Scandurra
74e5c5b89a Separate autoclose pair stack from autocomplete stack 2022-02-02 09:51:03 +01:00
Antonio Scandurra
79408464ea Navigate tabstops on tab even if the top of stack is a BracketPairState 2022-02-02 09:04:57 +01:00
Max Brunsfeld
6ff45f2ade Generalize autoclose stack to include snippet ranges as well 2022-02-01 17:40:39 -08:00
Max Brunsfeld
7270fd00ba Start work on handling snippet completions 2022-02-01 15:35:02 -08:00
Max Brunsfeld
1371a20e58 🎨 Return an option task from confirm_completion 2022-02-01 14:27:01 -08:00
Antonio Scandurra
6c7d2cf6b5 Apply additional edits when confirming a completion
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-01 17:38:11 +01:00
Nathan Sobo
497626ef2b Re-filter existing completions on selection update
We still request new completions, but this ensures results are up-to-date in the meantime.

Also: Cancel any pending completions task when we dismiss the completions dialog or start a new completions request.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-01 07:59:37 -07:00
Antonio Scandurra
b89a39bcb3 Filter and sort suggestions in autocomplete
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-01 15:11:20 +01:00
Antonio Scandurra
bcbd265de9 Dismiss autocomplete when moving outside of a word 2022-02-01 13:27:49 +01:00
Nathan Sobo
92f0491c0e Don't assign completion_state when completions are empty 2022-01-31 18:38:49 -07:00
Nathan Sobo
327ddbe2b4 Always issue a new completions request when typing a trigger character
We'll interpolate the anchor range of original request, but it's still a good idea to be up-to-date in case the language server is influenced by the content preceding the location. This doesn't *seem* to be the case with rust-analyzer so far, but it's how VS Code works so let's do it this way.
2022-01-31 18:34:20 -07:00
Nathan Sobo
ae0237c21b 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
1d1f8df180 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
8d2b7ba032 Insert completion text on enter
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:46:50 -08:00
Max Brunsfeld
071a55a7ab Allow selecting items from the autocomplete list
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:25:46 -08:00
Max Brunsfeld
16c0baced6 Dispatch editor events on the autocomplete list
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:15:30 -08:00
Max Brunsfeld
6da01eac9b Make editor element's paint and layout states non-optional
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:06:59 -08:00
Max Brunsfeld
c19d639e0a Derive autocomplete menu's width from the width of its largest item
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:01:20 -08:00
Nathan Sobo
1a6e972ed4 Get basic list of completions rendering without styling
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-31 13:17:42 -07:00
Nathan Sobo
ab6eb0a655 Start on completion rendering
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-31 12:19:17 -07:00
Nathan Sobo
960696a504 Bind autocomplete to ctrl-space
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-31 11:34:19 -07:00
Antonio Scandurra
03bcbdc33d WIP 2022-01-31 19:12:35 +01:00
Antonio Scandurra
08b8b60377
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
ce5270488f Propagate Cancel when editor is not in full mode
This is consistent with what VS Code and Sublime Text do and allows the user to
perform only one keybinding to e.g. dismiss the find bar when the query is
(partially) selected.
2022-01-30 16:01:53 +01:00
Antonio Scandurra
c53b6b907a Populate query with text under selection when hitting cmd-f 2022-01-30 16:01:05 +01:00
Antonio Scandurra
5ebd24d528 📝 Improve assertion comment 2022-01-29 10:41:55 +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
2d6e348185 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
Max Brunsfeld
5c7cea5a3e WIP - Navigate to prev/next search result 2022-01-28 14:00:00 -08:00
Max Brunsfeld
7e02d669e1 Add a simple unit test for find bar 2022-01-28 13:05:29 -08:00
Antonio Scandurra
5b9d791269 Implement regex search with multiline support
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-28 16:15:18 +01:00
Antonio Scandurra
b2ded5bca8 Optimize some common operations when MultiBuffer is a singleton 2022-01-28 11:50:13 +01:00
Antonio Scandurra
b980b11053 Implement whole word mode 2022-01-28 11:48:04 +01:00
Max Brunsfeld
34ed734749 Add highlighted_ranges API to editor
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 15:19:28 -08:00
Antonio Scandurra
dbf48d2a5b
Merge pull request #375 from zed-industries/more-project-diagnostics-styling
Last touches on project diagnostics for now
2022-01-27 16:47:05 +01:00
Antonio Scandurra
3853826f78 Pause cursor blinking only when editor is focused
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 16:33:47 +01:00
Antonio Scandurra
41ec4645ab Don't panic when ending transaction that wasn't started by the same editor
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 15:53:44 +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
Max Brunsfeld
76bbd101c6 Increase diagnostic editor's vertical scroll margin
This way, the first path header will always be fully visible when
you move your cursor to the beginning of the multibuffer.
2022-01-26 10:23:41 -08:00
Max Brunsfeld
9b9fcf6927 Avoid showing selection strip on top of diagnostic headers 2022-01-26 10:23:40 -08:00
Antonio Scandurra
b9b255652f Display squiggly underlines underneath text with diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 15:52:40 +01:00
Max Brunsfeld
a890787923 Render header blocks as horizontall fixed (like the gutter)
Tweak editor layout to perform horizontal autoscroll before
laying out the blocks, so that they can access the scroll position.
2022-01-25 17:19:38 -08:00
Max Brunsfeld
f19934096a Account for editor's full scroll width when laying out blocks
Compute the editor's scroll width earlier in layout and
store it on the layout state, rather than computing it repeatedly.
2022-01-25 16:31:14 -08:00
Max Brunsfeld
cefb63936d Tweak diagnostic header styling
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-25 15:33:49 -08:00
Max Brunsfeld
dbe969893c Show icons and counts in the project diagnostics tab
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-25 12:31:55 -08:00
Max Brunsfeld
c9b4bb78f2 Merge branch 'project-diagnostics-pinned-tab' into style-project-diagnostics 2022-01-25 12:20:37 -08:00
Max Brunsfeld
78b57e4d9d Scale diagnostic header and message text with editor font
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-25 12:10:11 -08:00
Nathan Sobo
0c6fd157ee Scale diagnostic headers icons with editor font and right align w/ line numbers
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-25 12:40:53 -07:00
Antonio Scandurra
7250974aa6 Style block decorations
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-25 17:07:12 +01:00
Antonio Scandurra
65d4c33c0e Format messages within backticks using bold instead of with a background 2022-01-25 15:50:49 +01:00
Antonio Scandurra
7e55353de8 Show error code in diagnostic header 2022-01-25 15:23:58 +01:00
Antonio Scandurra
ec0ca2a1b6 Display icon next to primary message 2022-01-25 15:15:03 +01:00
Antonio Scandurra
e7ec016350 Restyle diagnostic headers 2022-01-25 12:23:24 +01:00
Nathan Sobo
d192b6ebc7 Remove Worktree::abs_path
I'd like to only have methods related to absolute paths on local worktrees, because it's not really possible to implement them on remote worktrees since we don't know the full path being shared and wouldn't have anything to do with it anyway if we did.
2022-01-22 14:44:58 -07:00
Nathan Sobo
e2a2073bdb Remove worktree_path from File struct 2022-01-22 14:29:36 -07:00
Nathan Sobo
a73671e57c Revert "Replace project_path with project_entry in workspace::{Item, ItemView}"
This reverts commit 9c9a09cccb.
2022-01-21 11:07:10 -07:00
Nathan Sobo
9505d6cdcf Disable the nav history when selecting a definition in a different buffer
When jumping between different buffers, we don't care about the cursor's previous location. When navigating backward, we want to jump directly to the site of the jump.
2022-01-20 21:33:16 -07:00
Antonio Scandurra
377e41a90f Make navigation history work with project diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-20 18:21:48 +01:00
Antonio Scandurra
c450945001 WIP 2022-01-20 18:11:37 +01:00
Antonio Scandurra
fad5c98b8d Center selections when going to definition
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-20 17:33:07 +01:00
Antonio Scandurra
b6685a532c Make "go to definition" work in project diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-20 17:30:30 +01:00
Antonio Scandurra
d92b40474f Change GoToDefinition binding to F12
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-20 15:43:02 +01:00
Antonio Scandurra
66734e11af WIP: Start on a GoToDefinition action for the editor 2022-01-20 12:26:04 +01:00
Antonio Scandurra
71082d4cdc Return a Task<Result<()>> in {ItemView,Buffer,MultiBuffer}::save 2022-01-20 09:58:24 +01:00
Max Brunsfeld
0992132a0d Always open buffers via the project 2022-01-19 14:48:54 -08:00
Max Brunsfeld
f43dcd6763 Move logic for starting language servers to the project 2022-01-19 14:05:06 -08:00
Antonio Scandurra
10c64f527c WIP 2022-01-19 19:28:41 +01:00
Antonio Scandurra
ae284c2d8a Route save_as via the Project
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-19 18:44:48 +01:00
Antonio Scandurra
9c9a09cccb Replace project_path with project_entry in workspace::{Item, ItemView} 2022-01-19 15:56:04 +01:00
Antonio Scandurra
18f1040c85 Rename Navigation to NavHistory 2022-01-19 15:27:34 +01:00
Max Brunsfeld
05bf8f61e2 Avoid changing selection in buffer navigation dialogs
If an editor has highlighted_rows, autoscroll it to reveal those rows instead of
its cursor positions.
2022-01-18 17:29:33 -08:00
Max Brunsfeld
926306582b Add a unit test for navigation behavior at the editor level 2022-01-18 16:25:22 -08:00
Max Brunsfeld
f7326b8d74 Push to navigation history based on jump distance instead of time 2022-01-18 15:02:49 -08:00
Antonio Scandurra
16b82d59f1 Experiment with a more general way of pushing editor navigation entries 2022-01-18 18:03:10 +01:00
Antonio Scandurra
bb954e29cf Introduce a test to verify navigation 2022-01-18 10:03:56 +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
Max Brunsfeld
11b7270f68 Navigate to previous positions in editors when using navigation history 2022-01-17 16:01:52 -08:00
Antonio Scandurra
ea624c6cde Populate backward/forward stacks upon item deactivation
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-17 18:57:31 +01:00
Antonio Scandurra
bbf634f439 Start laying the foundation for a per-pane navigation system 2022-01-17 16:59:06 +01:00
Max Brunsfeld
b7561c6cef Add select_first and select_last bindings to outline view
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-14 10:45:37 -08:00
Max Brunsfeld
ea69dcd42a 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
a64ba8b687 Allow matching of context items in outline view 2022-01-14 11:09:02 +01:00
Max Brunsfeld
adeb7e6864 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
7913a1ea22 Include highlighting runs in Outline 2022-01-13 14:46:15 -08:00
Max Brunsfeld
3e1c559b2d Allow multiple disjoint nodes to be captured as matcheable in the outline query 2022-01-13 14:04:25 -08:00
Max Brunsfeld
373fe6fadf Change Editor::set_highlighted_row to take a row range
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-13 09:49:46 -08:00
Antonio Scandurra
055d48cfb2 Select the closest outline item when the outline view's query is empty
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-13 18:43:49 +01:00
Antonio Scandurra
2660d37ad8 Return Outline<Anchor> from MultiBuffer::outline
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-13 18:24:00 +01:00
Max Brunsfeld
63a401ac5d Add Buffer::outline method
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:17:49 -08:00
Max Brunsfeld
1a672929e0 Adjust BlockMap tests to reflect new tiebreaking behavior
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 12:11:55 -08:00
Max Brunsfeld
6865a42df9 Show error+warning counts in project diagnostics tab
Allow workspace items' tab contents to be arbitrary elements

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 10:51:28 -08:00
Max Brunsfeld
6ad9ff10c1 Ensure path headers appear before first diagnostic header
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 10:51:28 -08:00
Max Brunsfeld
9ccf2f3f58 Tweak theming of project diagnostics 2022-01-12 10:51:08 -08:00
Max Brunsfeld
b5ee095da9 Deduplicate path names in the project diagnostics view 2022-01-12 10:51:08 -08:00
Max Brunsfeld
a9937ee8be Expand block decorations' bounds to include the gutter 2022-01-12 10:51:08 -08:00
Antonio Scandurra
310def2923 Implement Buffer::format
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:01:20 +01:00
Antonio Scandurra
6fbbbab7ba Process selection anchors in a sorted fashion when refreshing them 2022-01-12 09:28:09 +01:00
Antonio Scandurra
b768a3977c Add unit test reproducing a panic when refreshing selections 2022-01-12 09:27:03 +01:00
Antonio Scandurra
7daa4b5b04 Don't return a Result in test-only method select_display_ranges 2022-01-12 09:14:48 +01:00
Antonio Scandurra
c16820166b Fix cursor position when inserting newlines on a repeated excerpt
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-11 18:30:25 +01:00
Antonio Scandurra
aa543a4b0a Ensure selections stay sorted after refreshing them
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-11 17:16:45 +01:00
Antonio Scandurra
e70b728758 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
Antonio Scandurra
b1de9a945d Fix outdent not working when cursor is at column 0 2022-01-10 15:32:28 +01:00
Antonio Scandurra
0742640b39 Correctly report line boundaries when a map contains both folds and wraps
This fixes the randomized test failures that were occurring on main.
2022-01-10 11:26:48 +01:00
Max Brunsfeld
f933d54469 When selections lose their excerpts, move them to the next primary diagnostic 2022-01-07 14:53:33 -08:00
Max Brunsfeld
ce6f3d7f3e Reuse views when moving between diagnostic view and editors
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-07 11:00:12 -08:00
Max Brunsfeld
ea263822fa 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 Scandurra
e5c520a265 Use Buffer handles instead of MultiBuffer as editor workspace items
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-07 17:48:31 +01:00
Antonio Scandurra
794d214eee Refactor opening workspace items
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-07 17:38:37 +01:00
Antonio Scandurra
3cab32d201 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
67f672d0cc Clear selections on other excerpted buffers when setting active selections 2022-01-07 10:19:28 +01:00
Max Brunsfeld
94e9c7fd5b Give a full-width background to the diagnostic headers 2022-01-06 17:55:56 -08:00
Max Brunsfeld
b19d92e918 Keep selections at the top of the project diagnostics view when it is first populated
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-06 17:01:13 -08:00
Nathan Sobo
2dbee1d914 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
Nathan Sobo
d7a78e14ac Allow disk-based diagnostic progress begin/end events to interleave
When multiple saves occur, we can have multiple start events followed by multiple end events. We don't want to update our project diagnostics view until all pending progress is finished.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-06 09:32:08 -07:00
Antonio Scandurra
1875a0e349 Polish rendering of inline errors
- Don't soft-wrap
- Render multiple lines

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-06 16:17:53 +01:00
Antonio Scandurra
f37f839330 Wire up refresh_anchors in Editor::refresh_selections and call it 2022-01-06 15:32:37 +01:00
Max Brunsfeld
7340e83059 WIP - MultiBuffer::refresh_anchors 2022-01-05 21:12:49 -08:00
Max Brunsfeld
fee7657fd7 Merge branch 'main' into polish-project-diagnostics 2022-01-05 20:38:20 -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
5a53eeef63 Don't scroll editors away from the top of their buffer when content changes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-05 12:31:00 -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
29b63ae4c6 Remove invalid excerpts as opposed to styling them differently 2022-01-05 18:21:17 +01:00
Antonio Scandurra
b2f0c78924 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
508b9dc024 Rip out "diagnostic providers" 2022-01-04 16:32:17 +01:00
Antonio Scandurra
2b31a48ef9 Clip right when moving to next word in case we land on a block line 2022-01-04 15:17:37 +01:00
Antonio Scandurra
ed361f2d1a Position selections correctly when duplicating lines in a multi-buffer 2022-01-04 15:17:37 +01:00
Antonio Scandurra
8dc9197324 Position cursors correctly in Editor::delete_line in a multi-buffer 2022-01-04 15:17:37 +01:00
Antonio Scandurra
05a6137549 Capture a new buffer snapshot for excerpts whose selections got updated 2022-01-04 12:22:51 +01:00
Max Brunsfeld
7f8e76e0f1 Remove worktree-specific methods from language::File trait
Use downcasting instead for accessing worktree-specific state of the Files.

This will allow us to introduce a WorktreeId type and use that everywhere
for identifying worktrees. It also just removes some unnecessary coupling
between the language crate and the worktree.
2022-01-04 11:28:44 +01:00
Nathan Sobo
6d6a82655a Create blocks with anchors to allow a bias to be specified
This allows us to respect the bias on anchors we use to create excerpt headers so that they always remain above any content inserted at the start of an excerpt.
2021-12-30 01:03:19 -08:00
Nathan Sobo
984378e12c Use anchors for line movement edits to support multi-buffers
Because multi-buffers can contain the same content multiple times, we need to use anchors to track our desired insertion and removal locations when moving lines. This is because deleting a line in order to move it might end up deleting *multiple* lines.
2021-12-29 23:47:03 -08:00
Max Brunsfeld
137fbd0088 Update editor element to use new {next,prev}_line_boundary methods
Since these methods take buffer points instead of display points, this adjusts
the logic for retrieving the visible selections, so that they are initially returned
in terms of buffer points.
2021-12-28 13:47:09 -08:00
Nathan Sobo
7f786ca8a6 WIP: Start moving toward a simpler interface for detecting prev/next line boundaries 2021-12-27 22:11:05 -08:00
Nathan Sobo
89bbfb8154 wip 2021-12-27 21:14:23 -08:00
Max Brunsfeld
6057d819b0 Add a unit test showing panic in move_line_down 2021-12-27 20:58:01 -08:00
Max Brunsfeld
accf90e843 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
Nathan Sobo
cbc162acf5 WIP: Allow lines to be moved down across excerpts
This is still a bit weird because we can't remove the last line of an excerpt but we still move it into another buffer. There also seem to be issues with undo.
2021-12-27 15:46:19 -08:00
Nathan Sobo
835af35839 Simplify prev/next_row_boundary methods
We added clipping of points against the buffer when excerpt headers were in the buffer, but now that they're just blocks, I think we can avoid the potential to panic in these methods by going back to not clipping.
2021-12-27 15:46:19 -08:00
Max Brunsfeld
3040cfece1 Fix Editor::newest_selection
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-27 15:42:37 -08:00