-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Initial implementation of global search #651
Conversation
Some improvements that can be made:
|
That's weird, why am I shown in the first commit? |
@kirawi Sorry but I have been scratching my head too. Perhaps I made a mistake when rebasing on master branch. Git did not complain anything though so I have no idea where I went wrong:\ |
Not sure, I'm no git whiz 😅 Maybe it's possible to remove me as the author? |
I did another rebase and force pushed to solve the issue. |
What's status of this pr? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, I finally did a full review here. I think it's a good first implementation, I'd still like to add a live search prompt in the future though 👍🏻
let mut searcher_cl = searcher.clone(); | ||
let matcher_cl = matcher.clone(); | ||
let all_matches_sx_cl = all_matches_sx.clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why clone here? Can't you make it a move closure? .run(move || {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WalkParallel::run takes a callback that returns a Box<dyn FnMut(Result<DirEntry, Error>) -> WalkState + Send + 's>
, which would capture searcher
, matcher
, all_matches_sx
. So I think the clone is necessary here.
Thanks for the solid advice! I'd love to keep working on this PR and I will work on these changes and rebase onto latest master as soon as I can. (I am currently occupied so maybe have to wait till this weekend) |
All changes are pushed and rebased onto latest master now. Let me know if you need me to rebase and squash the commits:) In the future I would like to bring up the picker as soon as |
Great work! |
Since we haven't figure out how to properly implement a global search feature yet #196 , I hope this could at least be an inspiration of an potential better design:)
This implementation bind
space + /
to display a prompt (like the search prompt), and onEnter
, start the search, gathers the result and pop up aFilePicker
. A few necessary changes are made, such asregex_prompt
, which now accepts an extra callback that would be invoked onceEnter
is pressed.Feel free to close this if we figure out something better later.