Commit Graph
2648 Commits
Author SHA1 Message Date
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
Max BrunsfeldandNathan Sobo 2a7c4eb0c7 Allow selecting items from the autocomplete list
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:25:46 -08:00
Max BrunsfeldandNathan Sobo 7cc6658775 Dispatch editor events on the autocomplete list
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:15:30 -08:00
Max BrunsfeldandNathan Sobo 70cb9adb1d 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 BrunsfeldandNathan Sobo e737c6fdfe 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 SoboandMax Brunsfeld c8460223fa Get basic list of completions rendering without styling
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-31 13:17:42 -07:00
a991daeb70 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 SoboandAntonio Scandurra e8094adae4 Bind autocomplete to ctrl-space
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-31 11:34:19 -07:00
Nathan SoboandAntonio Scandurra f89876f7db Return anchored completions from Buffer::completions
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-31 11:25:00 -07:00
Antonio Scandurra c80716473a WIP 2022-01-31 19:12:35 +01:00
Antonio ScandurraandNathan Sobo 1fcf6968bc Use StringMatchCandidate::new to construct candidates more conveniently
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 19:11:13 +01:00
Antonio ScandurraandNathan Sobo faae7097d4 Advertise additionalTextEdits resolution capability to language servers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 19:09:29 +01:00
Antonio Scandurra 91bed3466b v0.14 2022-01-31 15:14:54 +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 83b39bd194 Merge pull request #380 from zed-industries/find-bar
Find in buffer
2022-01-31 14:23:40 +01:00
Antonio ScandurraandNathan Sobo 766dd73d94 Move match index before the navigation buttons
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 14:06:49 +01:00
Antonio Scandurra 0595d2271f Assign a background to find buttons 2022-01-31 14:00:35 +01:00
Antonio Scandurra 78efeb91be Fix panic when moving to next/prev result but there are no matches 2022-01-31 11:04:53 +01:00
Antonio Scandurra 28be667abb Add some basic styling to FindBar 2022-01-31 11:00:29 +01:00
Antonio Scandurra 580b52251a Fix panic when closing pane's last item 2022-01-31 10:10:15 +01:00
Antonio Scandurra 7c9f25e956 Clear highlighted matches when dismissing FindBar 2022-01-31 09:58:03 +01:00
Nathan Sobo 12e7a0bafd Add cmd-g and cmd-shift-g to jump to next / previous result
I added the action handler on Pane so we can use these bindings when the find bar isn't focused.
2022-01-30 20:59:20 -07:00
Antonio Scandurra 69a3e151b7 Populate query and select it only if find bar isn't already deployed 2022-01-30 16:44:42 +01:00
Antonio Scandurra 48bd9d5189 Use cmd-f to move focus back to the editor when find bar is focused 2022-01-30 16:30:07 +01:00
Antonio Scandurra d18efa7edc Bind cmd-e to deploy FindBar without focusing it 2022-01-30 16:11:48 +01:00
Antonio Scandurra b7d56b7e45 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 1446f1833e Populate query with text under selection when hitting cmd-f 2022-01-30 16:01:05 +01:00
Antonio Scandurra c3e55b3222 Bind enter and shift-enter in FindBar 2022-01-30 15:20:57 +01:00
Antonio Scandurra 428c43d420 Show a message when no matches were found 2022-01-29 18:23:14 +01:00
Antonio Scandurra de774e2371 Fix panic when no matches were found 2022-01-29 18:21:19 +01:00
Antonio Scandurra e79e439ff7 Determine active match index correctly when cursor is after last match 2022-01-29 16:44:26 +01:00
Antonio Scandurra 6c636619c2 Select next/prev find match based on whether we intersect active match
Also, capture the next/prev selection logic in a unit test.
2022-01-29 16:16:48 +01:00
Antonio Scandurra c022c3826a Display active match and allow going to next or previous match
We still need to write a unit test for this, as well as add a keybinding.
2022-01-29 14:38:58 +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
Max Brunsfeld 7c33d0dfd4 WIP - Navigate to prev/next search result 2022-01-28 14:00:00 -08:00
Max Brunsfeld 981f00da33 Add a simple unit test for find bar 2022-01-28 13:05:29 -08:00
Max Brunsfeld dfa55cbf1b Merge pull request #376 from zed-industries/bump-rust-analyzer
Bump rust-analyzer to the 2022-01-24 release
2022-01-28 13:24:24 -07:00
Max Brunsfeld e5a75adb41 Adjust hover assertion in lsp test after bumping rust-analyzer 2022-01-28 12:11:26 -08:00
Antonio Scandurra cbdb9107cd Bump rust-analyzer to the 2022-01-24 release 2022-01-28 19:46:14 +01:00
79f59ac40f Optimize search when regex doesn't contain newlines
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-28 17:26:08 +01:00
Antonio ScandurraandNathan Sobo 7aec06cffe Implement regex search with multiline support
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-28 16:15:18 +01:00
Antonio ScandurraandNathan Sobo 3adb1789b3 Maintain search results as query and active editor changes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-28 15:19:58 +01:00
Antonio Scandurra eab37caea0 Move finding results in the background 2022-01-28 12:15:55 +01:00
Antonio Scandurra ccda42e148 Optimize some common operations when MultiBuffer is a singleton 2022-01-28 11:50:13 +01:00
Antonio Scandurra 67ac4b0bc2 Implement whole word mode 2022-01-28 11:48:04 +01:00
Nathan Sobo 7e792dd77f A bit more progress styling find
Fix the pinwheel when hovering mode buttons.
2022-01-27 18:59:44 -07:00
Max Brunsfeld d523c20027 WIP 2022-01-27 16:16:51 -08:00