Skip to content

Add fuzzy_nucleo crate for order independent file finder search#51164

Open
11happy wants to merge 4 commits intozed-industries:mainfrom
11happy:fuzzy
Open

Add fuzzy_nucleo crate for order independent file finder search#51164
11happy wants to merge 4 commits intozed-industries:mainfrom
11happy:fuzzy

Conversation

@11happy
Copy link
Contributor

@11happy 11happy commented Mar 10, 2026

Closes #14428

Before you mark this PR as ready for review, make sure that you have:

  • Added a solid test coverage and/or screenshots from doing manual testing
screencast.mp4
  • Done a self-review taking into account security and performance aspects
  • Aligned any UI changes with the UI checklist

Release Notes:

  • Adds a new fuzzy_nucleo crate that implements order independent path
    matching using the nucleo library. currently integrated for file finder.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 10, 2026
@dinocosta dinocosta added the area:file finder Feedback for file management, navigation, etc label Mar 10, 2026
11happy added 2 commits March 11, 2026 22:50
Signed-off-by: Bhuminjay <[email protected]>
Signed-off-by: Bhuminjay <[email protected]>
Copy link
Contributor Author

@11happy 11happy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have kept lot of data structures & methods similar to what already exist in current fuzzy crate & also took reference from this PR #37123 to implement path_match_helper

Comment on lines +760 to +770
.filter(|path_match| {
if let Some(filename) = path_match.path.file_name() {
let filename_start = path_match.path.as_unix_str().len() - filename.len();
path_match
.positions
.iter()
.any(|&pos| pos >= filename_start)
} else {
true
}
})
Copy link
Contributor Author

@11happy 11happy Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The earlier fuzzy matcher scored directory matches differntly however for example nucleo scores colab_ui against collab_ui/first.rs high, while working a previous test was failing (test_history_items_vs_very_good_external_match) so filtering out matches where query does not match filename.

Comment on lines +127 to +128
if let Some(score) = pattern.indices(haystack, matcher, &mut indices) {
let length_penalty = candidate_buf.len() as f64 * 0.001;
Copy link
Contributor Author

@11happy 11happy Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a length penalty as nucleo was scoring maaa.rs & moo.rs same (in this case when I debugged it was 80 for both ) causing some test failures ex.(test_keep_opened_file_on_top_of_search_results_and_select_next_one)

@yara-blue
Copy link
Member

hey @11happy I had a quick look and this looks pretty much great. I've set some time apart for a thorough review early next week but I expect we can merge this soon thereafter.

Thank you so much for this work, I've wanted this for quiet a while!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:file finder Feedback for file management, navigation, etc cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ordering of search tokens in file finder fuzzy match

4 participants