-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Picker
s "v2"
#9647
Picker
s "v2"
#9647
Conversation
For pickers with a single column, could we just hide the header in that case? That way it ends up looking like the original picker |
Just a couple things I noticed I haven't read trough all of it yet |
Yep actually we don't render the header if helix/helix-term/src/ui/picker.rs Lines 753 to 758 in e93685b
helix/helix-term/src/ui/picker.rs Lines 476 to 484 in e93685b
So the file picker doesn't look or behave any differently for example |
e93685b
to
827aeac
Compare
Very nice! For a slightly more compact look the column headers could be rendered with a different background - instead of having the line below. |
827aeac
to
fb63290
Compare
Yeah the separator lines were a little bulky. I removed the separators and added a theme key only for the header text |
or even move them into the separator below the input, similar to dbg mockups? |
02554fb
to
71e1d2f
Compare
That's much more complicated implementation-wise - we would probably need to change the table rendering in |
71e1d2f
to
3d78673
Compare
36a8e27
to
1dfbfe4
Compare
Wow, we have to get this on master! This solves my main issue with Helix. Brilliant work @the-mikedavis!!! |
Just started testing this. First of all, great work! One suggestion: Make debounce timeouts configurable. I have reduced them significantly (highlight: 150 -> 33 (I have a key-repeat synced to frame-rate, reason why it's so low while still debouncing effectively when scrolling), dynamic query: 275 -> 75). I have noticed flashes when using the |
What do you mean by flashes? Can you capture it in a gif / video / asciinema cast? W.r.t. configurable timeouts see #9668 (comment) |
Sure, here's an asciinema (edit: Just to confirm, since this was tested on a branch merged with all kinds of things, it also occurs on this one) |
Something I have noticed is that the global search no longer reads from the search selection. Which is a minor annoyance for something that completely replaces my use of fzf/rg. |
We could expand on this in the future to have different preview modes that you can toggle between with C-t. Currently that binding just hides the preview but it could switch between different preview modes and in one mode hide the path and just show the line contents.
This fixes the changed files picker when used against a clean worktree for example. Without it the running indicator does not disappear. It also simplifies the dynamic query handler's implementation so that it doesn't need to request a redraw explicitly. Co-authored-by: Pascal Kuthe <[email protected]>
This introduces a custom URI type in core meant to be extended later if we want to support other schemes. For now it's just a wrapper over a PathBuf. We use this new URI type to firewall `lsp::Url`. This was previously done in 8141a4a but using a custom URI type is more flexible and will improve the way Pickers handle paths for previews in the child commit(s). Co-authored-by: soqb <[email protected]>
The `FileLocation` and `PathOrId` types can borrow paths rather than requiring them to be owned. This takes a refactor of the preview functions and preview internals within `Picker`. With this change we avoid an unnecessary `PathBuf` clone per render for any picker with a file preview function (i.e. most pickers). This refactor is not fully complete. The `PathOrId` is _sometimes_ an owned `PathBuf`. This is for pragmatic reasons rather than technical ones. We need a further refactor to introduce more core types like `Location` in order to eliminate the Cow and only use `&Path`s within `PathOrId`. This is left for future work as it will be a larger refactor almost entirely fitting into the LSP commands module and helix-core - i.e. mostly unrelated to refactoring the `Picker` code itself. Co-authored-by: Pascal Kuthe <[email protected]>
`Picker::new` loops through the input options to inject each of them, so there's no need to collect into an intermediary Vec. This removes some unnecessary collections. Also, pickers that start with no initial options can now pass an empty slice instead of an empty Vec. Co-authored-by: Luis Useche <[email protected]>
This allows us to replace any `vec![..]`s of columns where all columns are static with static slices `[..]`.
83093cb
to
a8bfa0c
Compare
The issue in #9647 (comment) was solved with the last force-push |
We can track the ranges in the input text that correspond to each column and use this information during rendering to apply a new theme key that makes the "active column" stand out. This makes it easier to tell at a glance which column you're entering.
a8bfa0c
to
9de5f5c
Compare
Just built from master. What a happy surprise to discover that this has been merged! :) So far, so (mostly) good. Rather than open a bunch of issues, I'll quickly share some feedback here. I hope that's okay, seeing as this PR is closed.
Hope this is useful! Let me know if you'd prefer me to open separate issues instead :) |
For 1 see #9647 (comment). The width handling is naive and improvements can be made as follow-up PRs. For 2 there is a debounce now since global_search reruns as you change the query. It's a fairly expensive operation so we could turn down the debounce but the lower it goes the more global search will chip at your battery. I'm aware this breaks muscle memory but I'd rather have a better interface even if it means people have to retrain their muscle memory. |
This is awesome, thanks for all the hard work! |
The correct syntax would be |
Filtering on columns was implemented in helix-editor#9647. The only documentation I could find on this feature was the PR itself, and the video demo used a different syntax.
I was hoping to make these picker changes as separate PRs but they layer in a way that makes reviewing them independently awkward: one commit changes a block and the next changes it again, so I think it's easier to review altogether. This PR is a kind of "version 2" for the
Picker
component that resolves a bunch of things we've wanted to change aboutPicker
s:DynamicPicker
s, see Workspace symbol search does not support special characters #5714)IdleTimeout
approach for syntax highlighting the preview with an event-system hook (Refactor ad-hoc hooks to use the event system #9629)DynamicPicker
forglobal_search
(interactive global search #196)DynamicPicker
rather thanIdleTimeout
. As a consequence, we can merge theDynamicPicker
type intoPicker
, a refactor that joyously removes this unfortunate block.Shout out to @pascalkuthe's excellent work with the event system (#8021) and Nucleo (#7814) that make this change possible.
The table format and filtering by columns (originally posted in #7265):
Dynamic global search running against a very large directory (originally posted in #196):
Related to #9629
Closes #196
Closes #5714
Closes #5446
Closes #3543
Closes #4956
Closes #2109