Commit Graph

2141 Commits

Author SHA1 Message Date
Kirill Bulatov
7334bdccbf Better multibuffer tests 2023-08-16 23:38:11 +03:00
Kirill Bulatov
f9131f657e Use InlayHint instead of Inlay where appropriate 2023-08-16 23:38:11 +03:00
Kirill Bulatov
9c6135f47a Test hints toggle 2023-08-16 23:38:11 +03:00
Kirill Bulatov
0f650acc23 Repaint inlays icon on inlays cache disabling/enabling
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-08-16 23:38:11 +03:00
Kirill Bulatov
0b93e490a5 Improve toggle UI, fix inlays update speed 2023-08-16 23:38:11 +03:00
Kirill Bulatov
5c3d563f0f Draft quick actions bar 2023-08-16 23:38:11 +03:00
Conrad Irwin
7f06191c9f Disable autoindent in visual block insert mode 2023-08-16 10:44:59 -06:00
Conrad Irwin
1b4dd49b1d Vim visual block mode
This isn't quite an exact emulation, as instead of using one selection
that is magically in "column mode", we emulate it with a bunch of zed
multi-selections (one per line).

I think this is better, as it requires fewer changes to the codebase,
and lets you see the impact of any changes immediately on all lines.

Fixes: zed-industries/community#984
2023-08-15 16:00:50 -06:00
Conrad Irwin
404b1aa65a
Fix vim selection to include entire range (#2787)
Update vim mode to have vim selection and editor selections match.
Before this we had to adjust between vim selections and real selections
when making changes; now we have to adjust when making selections.

Release Notes:

- vim: Ensure editor selection matches the vim selection
([#1796](https://github.com/zed-industries/community/issues/1796)).
- vim: Fix `s` in visual line mode
- vim: Add `o` and `shift-o` to toggle direction of visual selection
- vim: Fix `v` and `shift-v` to toggle back to normal mode
- vim: Fix block selections like `vi}` to contain correct whitespace
2023-08-15 08:36:17 -06:00
Mikayla Maki
22da42fc69
Add components example (#2846)
This PR is a continuation of the components UI exploration I've been
doing. It adds an example to the GPUI examples page and totally
restructures the generics on our MouseEventHandler.

Release Note:
- N/A
2023-08-15 03:17:50 -07:00
Mikayla
e5eed29c72
Add components example
Re-arrange generics on mouse event handler
Add TypeTag struct for dynamically tagged components
2023-08-15 03:06:43 -07:00
Conrad Irwin
fb90eada70 Merge branch 'main' into vim-visual-selection 2023-08-14 15:29:33 -06:00
Conrad Irwin
5b37cdcb04 Better tests 2023-08-14 15:03:16 -06:00
Nathan Sobo
740b105330 Merge branch 'main' into taffy
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-08-14 13:50:21 -06:00
Kirill Bulatov
e0d011e354 Better assert multibuffer edit test results 2023-08-14 20:12:35 +03:00
Kirill Bulatov
4b3273182a Do not filter out hints to be removed 2023-08-14 19:20:20 +03:00
Kirill Bulatov
336fbb3392 Clip offsets in inlay hint queries 2023-08-14 18:39:30 +03:00
Kirill Bulatov
558367dc8b Optimize query ranges tracking 2023-08-14 16:19:44 +03:00
Kirill Bulatov
87e6651ecb Fix hint tests, add a char boundary bug test 2023-08-14 16:01:02 +03:00
Kirill Bulatov
449c009639 Properly generate ranges to query 2023-08-14 11:25:02 +03:00
Kirill Bulatov
56f89739f8 Do not add duplicate hints to the cache 2023-08-14 11:25:02 +03:00
Kirill Bulatov
0e2a1fc149 Query inlay hints for parts of the file 2023-08-14 11:25:02 +03:00
Kirill Bulatov
708409e06d Query hints on every scroll 2023-08-14 11:25:02 +03:00
Kirill Bulatov
5d2750e0d4 Hide inlay cache fields 2023-08-14 11:25:02 +03:00
Nathan Sobo
65123e6eed Allow individual corner radii on drop shadows 2023-08-12 10:58:08 -06:00
Nathan Sobo
84dc4090bd Wire up per corner radii for quad
Still need to expose this in the styling layer and allow images
to have per corner radii.
2023-08-12 10:40:23 -06:00
Nathan Sobo
5e36040533 Put a Taffy layout engine on window 2023-08-12 00:58:11 -06:00
Piotr Osiewicz
ffffbbea1f
chore: use Cow instead of String for tooltips (#2838)
A QoL change to align `Tooltip` with other elements like `Label`
Release Notes:

- N/A
2023-08-11 15:29:55 +02:00
Nathan Sobo
0bf607cd2d WIP 2023-08-10 10:26:48 -06:00
Nathan Sobo
c95aecdd53 Merge branch 'main' into cells 2023-08-08 21:23:57 -06:00
Nathan Sobo
db96fb1307 Merge remote-tracking branch 'origin/main' into paint-context 2023-08-08 18:27:16 -06:00
Nathan Sobo
54ca5f1d44
Replace context methods that take a window id with methods on window handles (#2832)
With this PR, I've eliminated almost all references to window ids
outside of the internals of GPUI. All public methods taking these ids
are now defined on `AnyWindowHandle`, which provides a more coherent
narrative around windows as a concept.
2023-08-08 17:51:37 -06:00
Piotr Osiewicz
1aff642981 Do not highlgiht selections at all over the threshold 2023-08-08 13:09:27 +02:00
Nathan Sobo
f0da6b05fd Remove TestAppContext::add_view
Instead, we now call this on window handles.
2023-08-07 22:46:48 -06:00
Nathan Sobo
d687c3d81f Merge remote-tracking branch 'origin/main' into window-handles 2023-08-07 22:07:20 -06:00
Nathan Sobo
f2be3181a9 Move window-related methods from TestAppContext to AnyWindowHandle 2023-08-07 20:23:04 -06:00
Nathan Sobo
486f5bc6ca Get compiling 2023-08-07 19:08:58 -06:00
Piotr Osiewicz
371c669e00 Address review feedback.
Rename selected_rows to background_highlight_row_ranges.
Do not return any ranges if there are more than 50k results
2023-08-08 02:47:49 +02:00
Piotr Osiewicz
b0fc6da55b Use display maps 2023-08-08 02:37:27 +02:00
Piotr Osiewicz
241d3951b8 Remove redundant argument 2023-08-08 02:25:30 +02:00
Piotr Osiewicz
42e1221357 Add upper bound limit. Remove dbg! statements 2023-08-08 02:17:11 +02:00
Piotr Osiewicz
fa16895976 Do not query start of range if it's end is the same as the previous hunk's 2023-08-08 00:27:38 +02:00
Piotr Osiewicz
ca21626064 Baseline: Improve selection rendering for large quantities from 270ms to 90ms 2023-08-07 23:32:27 +02:00
Conrad Irwin
19eb280351 Fix selection background too
Refactor code to centralize the logic too
2023-08-07 19:01:04 +01:00
Nathan Sobo
adc50469ff WIP 2023-08-06 12:45:31 -06:00
Joseph T. Lyons
1abb6a0176 Expand empty selections to cover full word and fix bugs 2023-08-05 11:31:21 -04:00
Joseph T. Lyons
12e8f417e4 Add more convert to case commands
ConvertToTitleCase
ConvertToSnakeCase
ConvertToKebabCase
ConvertToUpperCamelCase
ConvertToLowerCamelCase
2023-08-04 22:45:26 -04:00
Joseph T. Lyons
8c98b02e45 Add convert to {upper,lower} case commands
Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-08-04 15:10:33 -04:00
Conrad Irwin
22927fa1d7 Fix visual selection cursor in multibuffers 2023-08-04 14:39:16 +01:00
Nathan Sobo
379652f074 Merge branch 'main' into cells 2023-08-03 19:33:04 -06:00
Nathan Sobo
d3c1966d96
WIP: Return WindowHandle<V: View> from AppContext::add_window (#2820)
Instead of returning a usize for the window id, I'm instead returning a
`WindowHandle<V: View>` where `V` is the type of the window's root view.
@as-cii helped me with a cool technique using generic associated types
where methods on `WindowHandle` can return either T or Option<T>
depending on the `BorrowWindowContext::Result` associated type.

Some example usage...

```rs
let window = cx.add_window(|cx| MyView::new(cx));
let my_view = window.root(cx); // If cx is TestAppContext, returns MyView. Otherwise returns Option<MyView>, because the window could be closed.
```


This isn't insanely beneficial on its own, but I think it will help
clean up our testing story. I'm planning on making `window` more useful
in tests for laying out elements, etc.

- [x] Rework tests that call `add_window` 😅 to expect only a window in
return.
- [x] Get tests passing
- [x] 🚬  test
2023-08-03 18:45:51 -06:00
Nathan Sobo
485c0a482e Don't refcount window handles 2023-08-03 17:11:47 -06:00
Nathan Sobo
afcc0d621b WIP 2023-08-03 17:03:39 -06:00
Joseph T. Lyons
ee1b4a52cc
Add PathExt trait (#2823)
This PR adds a `PathExt` trait. It pulls in our existing `compact()`
function, as a method, and then adds a method, and testing, for
`icon_suffix()`. A test was added to fix:

- https://github.com/zed-industries/community/issues/1877

Release Notes:

- Fixed a bug where file icons would not be registered for files with
with `.` characters in their name
([#1877](https://github.com/zed-industries/community/issues/1877)).
2023-08-03 18:57:43 -04:00
Nathan Sobo
884cee6dfd Get tests compiling returning WindowHandle<V: View> from add_window 2023-08-02 14:05:03 -06:00
Max Brunsfeld
a127b0d3e6 Fix warnings surfaced in Rust 1.71 2023-08-02 09:19:23 -07:00
Conrad Irwin
5f6535e92b TEMP 2023-08-02 15:06:46 +01:00
Joseph T. Lyons
eb26fb2d45 Fix variable names 2023-08-01 11:52:53 -04:00
Mikayla Maki
88474a6048
Clip wrap guides from under the scrollbar 2023-07-31 10:54:29 -07:00
Mikayla Maki
d58f031696
disable wrap guides in the assitant panel 2023-07-28 22:27:36 -07:00
Conrad Irwin
645c149344 Fix visual selection of trailing newline 2023-07-28 22:38:39 -06:00
Mikayla Maki
d3b89e16f2
Make wrap guides respect scroll position 2023-07-28 14:56:13 -07:00
Conrad Irwin
9cb0ce7745 Review 2023-07-28 15:36:14 -06:00
Conrad Irwin
5edcb74760 Add support for visual ranges ending with a newline
These primarily happen when first entering visual mode, but can also
be created with objects like `vi{`.

Along the way fix the way ranges like `vi{` are selected to be more
similar to nvim.
2023-07-28 15:26:40 -06:00
Conrad Irwin
b53fb8633e Fix vim selection to include entire range
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2023-07-28 15:26:40 -06:00
Conrad Irwin
5d8370e2a1
Don't highlight project search matches either (#2807)
@JosephTLyons this is probably worth merging alongside #2803

- vim: Fix a bug where focusing project search results unexpectedly
entered visual mode
2023-07-28 12:25:32 -06:00
Conrad Irwin
fac0e2dd56 Don't highlight project search matches either 2023-07-28 12:17:32 -06:00
Conrad Irwin
ade8d4d167
Fix jumping to definition in a new file (#2803)
This is broken because vim currently sets settings only on the active
editor. Fix this by correcting the range on the currently active editor.

It would be nice (at some point) to refactor how vim sets settings, but
that's for another day.

Release Notes:

- vim: Fix bug when jumping to definition in new file accidentally
entered visual mode.
2023-07-27 19:10:01 -06:00
Conrad Irwin
1935307b4f Fix jumping to definition in a new file
This is broken because vim currently sets settings only on the active
editor. Fix this by correcting the range on the currently active editor.

It would be nice (at some point) to refactor how vim sets settings, but
that's for another day.
2023-07-27 18:10:17 -06:00
Mikayla Maki
354c020612
Block extra drag events in original drag handlers 2023-07-26 14:57:46 -07:00
Nathan Sobo
c602d98680 WIP 2023-07-26 13:34:57 -06:00
Nathan Sobo
1b03c5d69c Pass PaintContext to Element::paint
I want to use this on another branch, but it's a sweeping change,
so this prepares the ground for it. This can always be reverted if
it doesn't work out.
2023-07-25 17:32:31 -06:00
Joseph T. Lyons
4085df5146 Add tests for manipulate_lines() 2023-07-25 15:17:16 -04:00
Joseph T. Lyons
bf2ca57f55 Remove { and } from single-line closure 2023-07-25 14:48:11 -04:00
Joseph T. Lyons
93ec73da29 Fix code computing new selections
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-07-25 14:04:25 -04:00
Joseph T. Lyons
299818cde0 Fix rand import and tweak callbacks
Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-07-25 11:44:13 -04:00
Joseph T. Lyons
1a84382881 WIP 2023-07-25 10:33:20 -04:00
Kirill Bulatov
c538504b9c Do not scroll when selecting all 2023-07-22 00:17:02 +03:00
Mikayla Maki
05a8409363
bump the brightness of the active wrap guide 2023-07-20 16:45:41 -07:00
Mikayla Maki
a9bfe97361
Add wrap guides and associated settings 2023-07-20 16:39:13 -07:00
Conrad Irwin
372f66c88a
Add workspace::ActivatePaneInDirection (#2757)
This change adds support for choosing a pane based on direction; and
adds default keybindings (`cmd+k cmd+{left,right,up,down}`) and vim
keybindings.

Release Notes:

- Add support for navigating to the next pane in a given direction using
`cmd+k cmd-{up,down,left,right}`
([#476](https://github.com/zed-industries/community/issues/476),
[#478](https://github.com/zed-industries/community/issues/478))
- Vim: adds support for many window related shortcuts: `ctrl-w
{h,j,k,l,up,down,left,right,w,W,p}` for navigating around panes, `ctrl-w
{q,c}` for closing panes and `ctrl-w {v,s}` for splitting panes.
2023-07-20 11:17:13 -06:00
Kirill Bulatov
0237276557 Fully revert the line height change 2023-07-20 15:39:22 +03:00
Kirill Bulatov
0e6048a85d Keep basic line height for single line editors 2023-07-20 13:42:11 +03:00
Conrad Irwin
e1379f0ef0 Add support for activating a pane by direction
Contributes: zed-industries/community#476
Contributes: zed-industries/community#478
2023-07-19 18:29:11 -06:00
Mikayla Maki
cb97f5a69c
fmt 2023-07-19 16:56:49 -07:00
Mikayla Maki
aa67413abc
Raise minimum line height to 1.1
Disable buffer_line_height setting in non-buffer editors
2023-07-19 16:55:28 -07:00
Mikayla Maki
5ceb258b3e
Mute mics by default
Fix bug when file ends in line with 1 more digit displayed than previous lines
Remove stale UI elements from voice call development
2023-07-19 12:34:24 -07:00
Conrad Irwin
98b8008bcc Merge branch 'main' into vim-search 2023-07-19 09:48:25 -06:00
Kirill Bulatov
3058a96dee Clean up stale conflicting hints 2023-07-19 15:29:00 +03:00
Kirill Bulatov
9aeb970f09 Ignore empty hover contents, trim final hover label text 2023-07-18 22:53:44 +03:00
Conrad Irwin
c9bf407431 Avoid optional on select_match 2023-07-17 12:49:59 -06:00
Conrad Irwin
f887a17ffe Merge branch 'main' into vim-search 2023-07-17 09:27:02 -06:00
Alex Viscreanu
c7669317ec
feat(workspace): allow alternative actions to open files and symbols in split
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2023-07-14 21:49:15 +02:00
Kirill Bulatov
cde5b3952d
Select all matches (#2717)
Closes https://github.com/zed-industries/community/issues/75
Closes https://github.com/zed-industries/community/issues/1749

The PR 

* changes keybindings for `Editor && mode == auto_height` context:
before, `alt-enter` and `alt-shift-enter` added new lines in such
editors, including the one from buffer search.

New bindings are the same as in `Editor && mode == full` context.

* adds `search::SelectAllMatches` action and binds it to `Alt + Enter`
by default, to select all matches of a buffer search

The behavior mimics VSCode: we do not move the screen even if all
selections are out of the visible range (Cmd+G will navigate there) and
allow reselecting the results from both pane and search field, as long
as the search is not dismissed.

Release Notes:

- Added `search::SelectAllMatches` (`Alt + Enter` default) action to
place carets and select all buffer search results
([#75](https://github.com/zed-industries/community/issues/75),
[#1749](https://github.com/zed-industries/community/issues/1749)).
2023-07-14 21:37:04 +03:00
Max Brunsfeld
2f2ef7c165 Use workspace dependencies for tree-sitter grammars 2023-07-14 09:25:51 -07:00
Kirill Bulatov
ccc78000bd Preserve serach index for multicaret selection editor events 2023-07-14 14:47:12 +03:00
Kirill Bulatov
29cbeb39bd Allow selecting all search matches in buffer 2023-07-14 14:47:12 +03:00
Mikayla Maki
77c4fc98bd
Add line height settings for the editor 2023-07-13 16:14:33 -07:00
Mikayla Maki
b7ed467690
WIP: Resizing splits (#2715)
We're finally doing the thing. 


TODO:
- [x] Choose an approach 
- Decided to add a new element just for the pane axis, containing a
slimmed down copy of the flex code.
- [x] Wire through callbacks and pointers so that data goes where it
needs to
- [x] Do the flex juggling math on resize
- [x] Update the flexes when updating the split tree
- [x] Restore the active_pane_magnification setting
- [x] Serialize an axis' flexes

Release Notes:
- Made the center pane group splits resizable. Note that resizing is
disabled if the `active_pane_magnification` setting is changed from
default.
2023-07-13 15:29:34 -07:00
Mikayla Maki
d5f7ad08fa
Styled and refined behavior for split resizing 2023-07-13 11:28:21 -07:00
Kirill Bulatov
0c7949bdee Force resolve all completions, to ensure their edits are up-to-date
co-authored-by: Max Brunsfeld <max@zed.dev>
2023-07-12 21:10:01 +03:00
Kirill Bulatov
c732aa1617 Do not resolve completions if extra edits are available 2023-07-12 20:28:16 +03:00
Kirill Bulatov
6d96c6ef51 Draft the postfix completions support 2023-07-12 18:32:03 +03:00
Joseph T. Lyons
98a0113ac3 Add call events
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2023-07-11 13:58:55 -04:00
Kirill Bulatov
748e7af5a2 Add a test 2023-07-11 17:10:34 +03:00
Piotr Osiewicz
3c1ab3d0b8
Piotr/z 2590 search result marks jump around in scrollbar as cursor (#2700)
This closes ticket Z-2590 reported by @JosephTLyons . Thanks Joseph =)
Release Notes:

- N/A
2023-07-11 09:40:00 +02:00
Piotr Osiewicz
e83afdc5ab Rename background_highlights_in_range_for_key to background_highlights_in_range_for 2023-07-11 09:31:08 +02:00
Piotr Osiewicz
4f60679861 Highlight only search results 2023-07-11 09:28:34 +02:00
Piotr Osiewicz
a6d713eb3d editor: Keep scrollbar up if there are selections
Z-2556
2023-07-10 17:44:27 +02:00
Conrad Irwin
b4b0f622de Rebuild vim search experience on refactored code 2023-07-07 15:57:54 -06:00
Conrad Irwin
2ffce24ef0 vim: Don't enter visual mode in search/go to definition
Fixes: zed-industries/community#1514
Contributes: zed-industries/community#1284
2023-07-07 15:56:37 -06:00
Conrad Irwin
460bf93866
vim: { } to navigate by paragraph (#2668)
As part of this I added `assert_shared_state()` to the
NeovimBackedTestContext so that it is more like a drop-in replacement
for the VimTestContext.

The remaining part of zed-industries/community#682 is adding bracket
matching to plain text. It looks like the current logic requires there
to be a tree sitter language for the language in order to support
bracket matching. I didn't fix this in this PR because I was unsure
whether to try and work around that, or to try and add a plain text tree
sitter language.

Release Notes:

- vim: support `{` and `}` for paragraph motion
([#470](https://github.com/zed-industries/community/issues/470)).
- vim: fix `%` at the end of the line
([#682](https://github.com/zed-industries/community/issues/682)).
2023-07-07 14:59:06 -06:00
Kirill Bulatov
e6ec0af743 Remove redundant hint kind checks in tests 2023-07-06 23:27:25 +03:00
Piotr Osiewicz
3ca0170264
Z 1332/show search results in scrollbar (#2687)
This PR adds highlighting of search results to the scrollbar.

Release Notes:

- Added highlighting of search results to the scrollbar.
2023-07-06 19:28:21 +02:00
Kirill Bulatov
11ae99fbd6 Add a test 2023-07-06 17:16:34 +03:00
Antonio Scandurra
708852aa00 Clip left when finding preceding (line) boundary
This fixes an issue that was causing `alt-left` to not move the cursor
when it was located right after an inlay hint with a `Left` bias.
2023-07-06 16:25:27 +03:00
Piotr Osiewicz
3e245fec90 Save a flushing line instead of discarding it 2023-07-06 13:52:03 +02:00
Piotr Osiewicz
5e7d9dc718 Add hunk merging 2023-07-06 13:31:45 +02:00
Piotr Osiewicz
b66453e771 fixup! Do not render multiple hunks for the same line 2023-07-06 12:11:08 +02:00
Kirill Bulatov
0b0a161626 Show inlay hints on startup for every language server with work events
Language servers such as typescript-language-servers report a single
work event, ending right after server's startup.

Other servers might send more similar event, also during startup.
The rest of the events are diagnostic-related and we filter them out.

React on such events with /refresh-like hint update, that will check
only the visible part of the editor for hints and might be replaced by
other /refresh requests, if needed.
2023-07-06 13:10:59 +03:00
Piotr Osiewicz
492b849ea1 Do not render multiple hunks for the same line 2023-07-06 12:09:33 +02:00
Piotr Osiewicz
8ced7ab00a Merge branch 'main' into Z-1292/show_search_results_in_scrollbar 2023-07-06 11:43:44 +02:00
Kirill Bulatov
d7f6b5e1a0 Remove InlayProperties 2023-07-05 16:17:14 +03:00
Kirill Bulatov
6ba1c3071a Simplify inlay map data 2023-07-05 15:23:56 +03:00
Kirill Bulatov
85701c9b80 Do not perform OnTypeFormating after pair brace insert
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-07-03 17:21:44 +03:00
Kirill Bulatov
43d4f04331 Do not add extra spaces to hints 2023-07-03 11:17:12 +03:00
Kirill Bulatov
ae54e1d224 Remove excessive hint update queries
* Filter out queries for outdated buffers just before hint tasks spawn:
  multicared edits might empit standalone events simultaneously
* Only spawn inlay update tasks for visible buffers with corresponding
  language
* Do not spawn tasks for local projects' buffers without LSP servers
2023-06-30 22:03:21 +03:00
Conrad Irwin
abb58c41db vim: Fix edge-case in } when trailing newline is absent
Added .assert_shared_state() to NeovimBackedTestContext – although it's
not strictly necessary to show the expected behaviour in the test file
(as we can just compare to neovim's JSON recording), it makes it much
easier to understand what we're testing.
2023-06-29 23:31:22 -06:00
Conrad Irwin
9ee2707d43 vim: Add }/{ for start/end of paragraph
Fixes: zed-industries/community#470
2023-06-29 23:31:22 -06:00
Kirill Bulatov
b146762f68 Remove a flacky test, fix the failing one 2023-06-29 22:45:04 +03:00
Kirill Bulatov
652909cdba Post-rebase fixes 2023-06-29 22:39:33 +03:00
Kirill Bulatov
3445bc42b6 Invalidate refresh tasks better 2023-06-29 22:39:18 +03:00
Kirill Bulatov
98edc0f885 Simplify the hint cache code 2023-06-29 22:39:18 +03:00
Kirill Bulatov
083e4e76e2 Better tests, invalidate multibuffer excerpts better 2023-06-29 22:39:18 +03:00
Kirill Bulatov
943c93fda7 Simplify hint task queueing 2023-06-29 22:39:18 +03:00
Kirill Bulatov
30e77aa388 More inlay hint cache tests 2023-06-29 22:39:18 +03:00
Kirill Bulatov
429a9cddae Use fold points to go to display map's prev/next line boundary
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:39:18 +03:00
Kirill Bulatov
bb9ade5b6f Fix wrap map test
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:39:18 +03:00
Kirill Bulatov
2b59f27c3b Fix fold map tests
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:39:18 +03:00
Kirill Bulatov
0972766d1d Add more hint tests 2023-06-29 22:39:18 +03:00
Kirill Bulatov
15e0feb91d Move highlights from fold to inlay randomized tests 2023-06-29 22:39:18 +03:00
Kirill Bulatov
667b70afde Move hint settings on the language level 2023-06-29 22:39:18 +03:00
Kirill Bulatov
480d8c511b Theme hints and suggestions differently 2023-06-29 22:39:18 +03:00
Kirill Bulatov
3312c9114b Improve inlay hint highlights
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:39:18 +03:00
Kirill Bulatov
2c54d926ea Test inlay hint cache 2023-06-29 22:39:18 +03:00
Nate Butler
143a020694 Update Hint Style
zzz
2023-06-29 22:39:17 +03:00
Kirill Bulatov
67214f0e55 Only skip /refresh inlay queries when vislble range is not updated 2023-06-29 22:25:50 +03:00
Kirill Bulatov
096bad1f73 Revert useless changes, simplify 2023-06-29 22:25:50 +03:00
Antonio Scandurra
f77b680db9 Account for inlay biases when clipping a point 2023-06-29 22:25:50 +03:00
Kirill Bulatov
5c21ed4263 Properly filter out task hints 2023-06-29 22:25:50 +03:00
Kirill Bulatov
dfb30218ca Remove mutex usage from *Map contents 2023-06-29 22:25:50 +03:00
Kirill Bulatov
acef5ff195 Query hints when editors gets open and visible 2023-06-29 22:25:50 +03:00
Kirill Bulatov
11fee4ce42 Do not eagerly cancel running tasks 2023-06-29 22:25:49 +03:00
Kirill Bulatov
4d4544f680 Split excerpts into mutliple ranges for inlay hint queries 2023-06-29 22:25:49 +03:00
Kirill Bulatov
2c7900e11b Use excerpt visible range in query filtering 2023-06-29 22:25:49 +03:00
Kirill Bulatov
83b3a914bc Support better inlay cache parallelization 2023-06-29 22:25:49 +03:00
Kirill Bulatov
890b164278 Forward inlay hint refresh requests to clients, test coop inlay hints 2023-06-29 22:25:49 +03:00
Kirill Bulatov
a68e68a0d9 Properly filter out new hints outside of excerpts' visible ranges 2023-06-29 22:25:49 +03:00
Kirill Bulatov
ba3d1e4dba Deduplicate inlay hints queries with buffer versions 2023-06-29 22:25:49 +03:00
Kirill Bulatov
f25a09bfd8 Avoid excessive allocations with Arc around excerpt cached inlays 2023-06-29 22:25:49 +03:00
Kirill Bulatov
48982c3036 Filter away new hints not in excerpt range 2023-06-29 22:25:49 +03:00
Kirill Bulatov
316e19ce94 Remove stale cancelled inlay hints workaround 2023-06-29 22:25:49 +03:00
Kirill Bulatov
96a34ad0ee Use text anchors as hint position in hints cache
co-authored-by: Max Brunsfeld <max@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
781fa0cff4 Deduplicate LSP requests on multibuffer scroll 2023-06-29 22:25:49 +03:00
Kirill Bulatov
cb4b92aa61 Simplify hint event management slightly 2023-06-29 22:25:49 +03:00
Kirill Bulatov
d59e91aff2 Insert new hints into cache better 2023-06-29 22:25:49 +03:00
Kirill Bulatov
d6828583d8 Box the cache for better performance 2023-06-29 22:25:49 +03:00
Kirill Bulatov
1722d61190 Mitigate odd offset calculations 2023-06-29 22:25:49 +03:00
Kirill Bulatov
7fddc223cd Move away heavy inlay computations into background tasks 2023-06-29 22:25:49 +03:00
Kirill Bulatov
31f0f9f7b1 Forbid extra inlay updates 2023-06-29 22:25:49 +03:00
Kirill Bulatov
97e5d40579 Add snapshot version to use when avoiding wrong state updates 2023-06-29 22:25:49 +03:00
Kirill Bulatov
8d982a6c2d Finish modelling 2023-06-29 22:25:49 +03:00
Kirill Bulatov
4c78019317 Start to model the background threads for InlayHintCache 2023-06-29 22:25:49 +03:00
Kirill Bulatov
2f1a27631e React on multibuffer scrolls again 2023-06-29 22:25:49 +03:00
Kirill Bulatov
a31d3eca45 Spawn cache updates in separate tasks 2023-06-29 22:25:49 +03:00
Antonio Scandurra
9698b51524 Prevent insertion of empty inlays into InlayMap 2023-06-29 22:25:49 +03:00
Kirill Bulatov
3b9a2e3261 Do not track editor ranges in InlayHintCache 2023-06-29 22:25:49 +03:00
Kirill Bulatov
70a45fc800 Fix cache incremental updates 2023-06-29 22:25:49 +03:00
Kirill Bulatov
7ac1885449 Properly refresh hints on editor open 2023-06-29 22:25:49 +03:00
Kirill Bulatov
58343563ba Fix hint querying bugs 2023-06-29 22:25:49 +03:00
Kirill Bulatov
debdc3603e Finish rest of the inlay cache logic 2023-06-29 22:25:49 +03:00
Kirill Bulatov
ddcbc73bf0 Implement inlay hint replaces for conflict-less case 2023-06-29 22:25:49 +03:00
Kirill Bulatov
6368cf1a27 Merge excerpt-related hint data, move next_inlay_id into Editor 2023-06-29 22:25:49 +03:00
Kirill Bulatov
8c03e9e122 Move InlayId generation back to InlayCache 2023-06-29 22:25:49 +03:00
Kirill Bulatov
e82b4d8957 Properly handle hint addition queries 2023-06-29 22:25:49 +03:00
Kirill Bulatov
5322aa09b9 Properly handle settings toggle 2023-06-29 22:25:49 +03:00
Kirill Bulatov
8f68688a64 Allow readding inlays with existing ids, move inlay types 2023-06-29 22:25:49 +03:00
Kirill Bulatov
49c00fd571 Generate InlayIds in InlayMap, prepare InlayCache for refactoring 2023-06-29 22:25:49 +03:00
Kirill Bulatov
e217a95fcc Cleanup the warnings 2023-06-29 22:25:49 +03:00
Kirill Bulatov
76d35b7122 Use proper, limited excerpt ranges and manage inlay cache properly 2023-06-29 22:25:49 +03:00
Kirill Bulatov
2b989a9f12 Fix all the tests
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
d4d88252c3 Fix most of the FoldMap random tests with inlays
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
f2c510000b Fix all FoldMap tests (without real inlays inside)
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
29bb6c67b0 Fix first FoldMap methods after the map move
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
9ae611fa89 Fix InlayMap bugs after the map order revers
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
05dc672c2a Apply questionable changes to make things compile 2023-06-29 22:25:49 +03:00
Kirill Bulatov
10765d69f4 Move inlay map to be the first one
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
e744fb8842 Avoid having carriage returns (\r) in inlays
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
d2fef07782 Remove the SuggestionMap
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
8cdf1a0faf Switch over to inlay map for Copilot suggestions
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Antonio Scandurra
89137e2e83 Fix InlayMap::buffer_rows 2023-06-29 22:25:49 +03:00
Kirill Bulatov
34c6d66d04 Implement InlayBufferRows properly
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
bec9c26fa2 Fix more inlay_map corner cases and hangings
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
02e124cec4 Fix inlay map tests
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
b231fa47af Apply hints setings on startup 2023-06-29 22:25:49 +03:00
Kirill Bulatov
c898298c5c Properly update inlay hints when settings are changed 2023-06-29 22:25:49 +03:00
Kirill Bulatov
1ed52276e0 Add inlay hint settings 2023-06-29 22:25:49 +03:00
Kirill Bulatov
ea837a183b Store inlays per paths and query on editor open 2023-06-29 22:25:49 +03:00
Kirill Bulatov
8acc5cf8f4 Deserialize more LSP inlay hint information 2023-06-29 22:25:49 +03:00
Kirill Bulatov
f155f5ded7 Better rpc inlay hint handling 2023-06-29 22:25:49 +03:00
Kirill Bulatov
b3aa75a363 Refresh inlays on buffer reopens 2023-06-29 22:25:49 +03:00
Kirill Bulatov
e1f22c3684 Cache anchors from all versions, remove out of range hints 2023-06-29 22:25:49 +03:00
Kirill Bulatov
7abaf22b93 Generate proper inlay diffs for splice 2023-06-29 22:25:49 +03:00
Kirill Bulatov
6d1068d1e9 Query inlay hints for excerpt ranges only 2023-06-29 22:25:49 +03:00
Kirill Bulatov
271cd25a1d Display excerpt-ranged hints only 2023-06-29 22:25:49 +03:00
Kirill Bulatov
addb62c1fc Fix the duplicate hints
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
63074c5cd8 Better bias selection for hints that prefix the type
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Antonio Scandurra
2b1b1225f5 Simplify InlayMap::splice interface 2023-06-29 22:25:49 +03:00
Antonio Scandurra
7684a26daa Fix point/offset translation and clipping in the InlayMap
This makes all randomized tests pass. We're only missing `buffer_rows`
now and we should move the map right above `MultiBuffer` and below `FoldMap`.
2023-06-29 22:25:49 +03:00
Kirill Bulatov
c7fa8dbc70 React with inlay updates on excerpt events 2023-06-29 22:25:49 +03:00
Kirill Bulatov
df20a43704 Reuse the copilot suggestion style for inlays 2023-06-29 22:25:49 +03:00
Kirill Bulatov
8a64b07622 Fixed inlay hints' edits generation and moved on with the randomized
test

Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Antonio Scandurra
e280483c5f Make the randomized tests pass
Right now we only check that the text is correct, but I think
we're getting there.
2023-06-29 22:25:49 +03:00
Kirill Bulatov
afa59eed01 Fix the randomized tests
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
f940104b6f Add inlay hint randomization in the text
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
dbd4b33568 Fix splice edits generation
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
9ce9b73879 Generate edits for inlay hints
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
f5f495831a Add inlay hints randomized test, fix the errors
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
2e730d8fa4 Implement initial changes reporting for inlay hints
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
4d76162da8 Report the edits per transform summary generated
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
2ba3262f29 Add line_len snapshot method
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
ab7dd80423 Add more InlaySnapshot text summary impls
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
568a67c4d7 Implement more InlaySnapshot methods
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Kirill Bulatov
daa2ebb57f Calculate anchors for new hints 2023-06-29 22:25:49 +03:00
Kirill Bulatov
5fadbf77d4 Implement InlayHint sync method and fix the bugs
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:48 +03:00
Kirill Bulatov
5ad85b44d6 Implement chunks of the InlayMap
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:48 +03:00
Kirill Bulatov
3028767d12 Improve on inlya locations 2023-06-29 22:25:48 +03:00
Kirill Bulatov
b193d62a5d Initial InlayMap tests and splice fn impl
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:48 +03:00
Kirill Bulatov
7397b8028c Simplify inlay hint version handling 2023-06-29 22:25:48 +03:00
Kirill Bulatov
d506522eef Correctly pass inlay hints 2023-06-29 22:25:48 +03:00
Kirill Bulatov
b5233b3ad5 Rename the new map 2023-06-29 22:25:48 +03:00
Kirill Bulatov
9287634548 Prepare to find diffs between inlay hint generations 2023-06-29 22:25:48 +03:00
Kirill Bulatov
78b3c9b88a Store hints in the new map only 2023-06-29 22:25:48 +03:00
Kirill Bulatov
83f4320b60 Replace todo!s with stub calls to make Zed work 2023-06-29 22:25:48 +03:00
Kirill Bulatov
4c3c0eb796 Draft the hint render data flow 2023-06-29 22:25:48 +03:00
Kirill Bulatov
2ead3de7de Add basic infrastructure for inlay hints map 2023-06-29 22:25:48 +03:00
Kirill Bulatov
6e3d1b962a Draft the initial protobuf changes 2023-06-29 22:25:48 +03:00
Kirill Bulatov
387415eb01 Request hints for all buffers in editor 2023-06-29 22:25:48 +03:00
Kirill Bulatov
f83cfda9bc React on message-less LSP requests properly
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-29 22:25:48 +03:00
Kirill Bulatov
7a268b1cf6 Improve obvious faults 2023-06-29 22:25:48 +03:00