editor: Improve selection highlights speed (#29097)
Before, we used to debounce selection highlight because it needed to search the whole file to show gutter line highlights, etc. This experience felt extremely laggy. This PR introduces a new approach where: 1. We query only visible rows without debounce. The search function itself is async and runs in a background thread, so it's not blocking anything. With no debounce and such a small search space, highlights feel realtime. 2. In parallel, we also query the whole file (still debounced, like before). Once this query resolves, it updates highlights across the file, making scrollbar markers visible. This hybrid way gives the feeling of realtime, while keeping the same functionality. https://github.com/user-attachments/assets/432b65f1-89d2-4658-ad5e-048921b06a23 P.S. I have removed the user setting for custom debounce delay, because (one) now it doesn't really make sense to configure that, and (two) the whole logic is based on the assumption that the fast query will resolve before the debounced query. A static debounce time makes sure of that. Configuring it might lead to cases where the fast query resolves after the debounced query, and we end up only seeing visible viewport highlights. Release Notes: - Improved selection highlight speed.
This commit is contained in:
parent
8f308d835a
commit
f737c4d01e
4 changed files with 146 additions and 100 deletions
|
@ -536,13 +536,6 @@ List of `string` values
|
|||
- Setting: `selection_highlight`
|
||||
- Default: `true`
|
||||
|
||||
## Selection Highlight Debounce
|
||||
|
||||
- Description: The debounce delay before querying highlights based on the selected text.
|
||||
|
||||
- Setting: `selection_highlight_debounce`
|
||||
- Default: `50`
|
||||
|
||||
## LSP Highlight Debounce
|
||||
|
||||
- Description: The debounce delay before querying highlights from the language server based on the current cursor location.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue