Commit Graph

1916 Commits

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