Commit Graph

431 Commits

Author SHA1 Message Date
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