Commit Graph
10299 Commits
Author SHA1 Message Date
Mikayla Maki 91f2a5401c fmt and update dependency 2023-06-29 17:49:42 -07:00
Mikayla Maki 742da534a2 Fix edge case with absolute file paths 2023-06-29 17:48:01 -07:00
Mikayla Maki f416d9ef00 Add the ability to make new directories by adding slashes to a file name 2023-06-29 17:35:22 -07:00
Mikayla Maki fef68e8480 Add click out events to GPUI (#2659)
This PR adds a new mouse event type for catching when a click happens
outside of a given region.

This was added because I noticed a 'race condition' between the context
menu and the buttons which deploy a context menu. Buttons use on
an`on_click()` handler to deploy the context menu, but the context menu
was closing itself with an `on_down_out()` handler. This meant that the
order of operations was:

0. Context menu is open
1. User presses down on the button, _outside of the context menu_ 
2. `on_down_out()` is fired, closing the context menu
3. User releases the mouse
4. `click()` is fired, checks the state of the context menu, finds that
it's closed, and so opens it

You can see this behavior demonstrated with this video with a long-click
here:


https://github.com/zed-industries/zed/assets/2280405/588234c3-1567-477f-9a12-9e6a70643527

~~Switching from `on_down_out()` to `on_click_out()` means that the
click handler for the button can close the menu before the context menu
gets a chance to close itself.~~

~~However, GPUI does not have an `on_click_out()` event, hence this
PR.~~

~~Here's an example of the new behavior, with the same long-click
action:~~


https://github.com/zed-industries/zed/assets/2280405/a59f4d6f-db24-403f-a281-2c1148499413

Unfortunately, this `click_out` is the incorrect event for this to
happen on. This PR now adds a mechanism for delaying the firing of a
cancel action so that toggle buttons can signal that this on_down event
should not result in a menu closure.

Release Notes:

* Made context menus deployed from buttons toggle, instead of
hide-and-re-show, visibility on click
2023-06-29 17:33:37 -07:00
Mikayla Maki 8eca1fdbb8 fmt 2023-06-29 17:19:35 -07:00
Mikayla Maki 74fefb0002 Remove on_click_out handler from context menu
Add 'delay_cancel()' method and on_down handler to relevant buttons
2023-06-29 17:10:51 -07:00
Kirill Bulatov 023ede7a5c Support basic inlay hints (#2660)
Part of https://github.com/zed-industries/community/issues/138
Part of https://linear.app/zed-industries/issue/Z-477/inlay-hints

Supports LSP requests for inlay hints, LSP /refresh request to reload
them.
Reworks DisplayMap and underlying layer to unite suggestions with inlay
hints into new, `InlayMap`.
Adds a hint cache inside `Editor` that tracks buffer/project/LSP request
events, updates the hints and ensures opened editors are showing up to
date text hints on top.

Things left to do after this PR:
* docs on how to configure inlay hints
* blogpost
* dynamic hints: resolve, hover, navigation on click, etc.

Release Notes:

- Added basic support of inlay hints
2023-06-29 22:49:39 +03:00
Kirill Bulatov b56e2b4a28 Remove a flacky test, fix the failing one 2023-06-29 22:45:04 +03:00
Kirill Bulatov 3a66693941 Post-rebase fixes 2023-06-29 22:39:33 +03:00
Kirill Bulatov 4afeb64e4c Invalidate refresh tasks better 2023-06-29 22:39:18 +03:00
Kirill Bulatov 5f79eea757 Simplify the hint cache code 2023-06-29 22:39:18 +03:00
Kirill Bulatov 54a4c0d0e3 Better tests, invalidate multibuffer excerpts better 2023-06-29 22:39:18 +03:00
Kirill Bulatov 95cc88678e Simplify hint task queueing 2023-06-29 22:39:18 +03:00
Kirill Bulatov 7ae67fc0b1 More inlay hint cache tests 2023-06-29 22:39:18 +03:00
Kirill BulatovandAntonio Scandurra 379325c8c4 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 BulatovandAntonio Scandurra 9bdbf83f2e Fix wrap map test
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:39:18 +03:00
Kirill BulatovandAntonio Scandurra 4b5e5c8206 Fix fold map tests
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:39:18 +03:00
Kirill Bulatov a92bc13f72 Add more hint tests 2023-06-29 22:39:18 +03:00
Kirill Bulatov aefc4e1748 Move highlights from fold to inlay randomized tests 2023-06-29 22:39:18 +03:00
Kirill Bulatov ff5645c43b Move hint settings on the language level 2023-06-29 22:39:18 +03:00
Kirill Bulatov 62c136a59d Theme hints and suggestions differently 2023-06-29 22:39:18 +03:00
Kirill BulatovandAntonio Scandurra 16ffe2d503 Improve inlay hint highlights
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:39:18 +03:00
Kirill Bulatov b85bb724fa Test inlay hint cache 2023-06-29 22:39:18 +03:00
Nate Butler b39ef4ba1b Update Hint Style
zzz
2023-06-29 22:39:17 +03:00
Kirill Bulatov 31eb20a5a6 Only skip /refresh inlay queries when vislble range is not updated 2023-06-29 22:25:50 +03:00
Kirill Bulatov 26d34594b2 Revert useless changes, simplify 2023-06-29 22:25:50 +03:00
Antonio Scandurra 1a0d9873b2 Account for inlay biases when clipping a point 2023-06-29 22:25:50 +03:00
Antonio Scandurra bf853d0f25 Add Cursor::next_item 2023-06-29 22:25:50 +03:00
Kirill Bulatov d2577744d8 Properly filter out task hints 2023-06-29 22:25:50 +03:00
Kirill Bulatov 536ed453a3 Remove mutex usage from *Map contents 2023-06-29 22:25:50 +03:00
Kirill Bulatov c4dc09f02c Query hints when editors gets open and visible 2023-06-29 22:25:50 +03:00
Kirill Bulatov 05415a2cf9 Do not eagerly cancel running tasks 2023-06-29 22:25:49 +03:00
Kirill Bulatov ab04c82a64 Split excerpts into mutliple ranges for inlay hint queries 2023-06-29 22:25:49 +03:00
Kirill Bulatov 146a00a247 Use excerpt visible range in query filtering 2023-06-29 22:25:49 +03:00
Kirill Bulatov b4cf47d0dd Support better inlay cache parallelization 2023-06-29 22:25:49 +03:00
Kirill Bulatov 25129daf7a Forward inlay hint refresh requests to clients, test coop inlay hints 2023-06-29 22:25:49 +03:00
Kirill Bulatov ec8e1aeefe Properly filter out new hints outside of excerpts' visible ranges 2023-06-29 22:25:49 +03:00
Kirill Bulatov fdc6e51357 Deduplicate inlay hints queries with buffer versions 2023-06-29 22:25:49 +03:00
Kirill Bulatov 350798d1b1 Avoid excessive allocations with Arc around excerpt cached inlays 2023-06-29 22:25:49 +03:00
Kirill Bulatov ccfd00e070 Filter away new hints not in excerpt range 2023-06-29 22:25:49 +03:00
Kirill Bulatov fa1196dabf Remove stale cancelled inlay hints workaround 2023-06-29 22:25:49 +03:00
Kirill BulatovandMax Brunsfeld 157922935e 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 53aeae3a30 Deduplicate LSP requests on multibuffer scroll 2023-06-29 22:25:49 +03:00
Kirill Bulatov 901ff983fd Use proper anchors for remote LSP queries 2023-06-29 22:25:49 +03:00
Kirill Bulatov e1555caaae Simplify hint event management slightly 2023-06-29 22:25:49 +03:00
Kirill Bulatov 9f8a6a2e35 Insert new hints into cache better 2023-06-29 22:25:49 +03:00
Kirill Bulatov 87b0fb2bc6 Box the cache for better performance 2023-06-29 22:25:49 +03:00
Kirill Bulatov e153097ad3 Mitigate odd offset calculations 2023-06-29 22:25:49 +03:00
Kirill Bulatov a555d28a65 Move away heavy inlay computations into background tasks 2023-06-29 22:25:49 +03:00
Kirill Bulatov 684a6a5fa4 Forbid extra inlay updates 2023-06-29 22:25:49 +03:00