mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-25 10:56:19 +04:00
9e31ba5475
DynamicPicker is a thin wrapper over Picker that holds some additional state, similar to the old FilePicker type. Like with FilePicker, we want to fold the two types together, having Picker optionally hold that extra state. The DynamicPicker is a little more complicated than FilePicker was though - it holds a query callback and current query string in state and provides some debounce for queries using the IdleTimeout event. We can move all of that state and debounce logic into an AsyncHook implementation, introduced here as `DynamicQueryHandler`. The hook receives updates to the primary query and debounces those events so that once a query has been idle for a short time (275ms) we re-run the query. A standard Picker created through `new` for example can be promoted into a Dynamic picker by chaining the new `with_dynamic_query` function, very similar to FilePicker's replacement `with_preview`. The workspace symbol picker has been migrated to the new way of writing dynamic pickers as an example. The child commit will promote global search into a dynamic Picker as well. |
||
---|---|---|
.. | ||
commands | ||
handlers | ||
keymap | ||
ui | ||
application.rs | ||
args.rs | ||
commands.rs | ||
compositor.rs | ||
config.rs | ||
events.rs | ||
handlers.rs | ||
health.rs | ||
job.rs | ||
keymap.rs | ||
lib.rs | ||
main.rs |