Skip to content

Make file picker autocompletion case-insensitive #464

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

Merged
merged 2 commits into from
Jun 11, 2025

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Jun 11, 2025

No description provided.

@@ -5,6 +5,7 @@ use std::cmp::Ordering;
use std::fs;
use std::path::{Path, PathBuf};

use edit::arena::scratch_arena;
Copy link
Member Author

Choose a reason for hiding this comment

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

let mut files = Vec::new();
let mut off = 0;
// ["..", directories, files]
let mut dirs_files = [Vec::new(), Vec::new(), Vec::new()];
Copy link
Member Author

Choose a reason for hiding this comment

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

This split allows us to use binary search to quickly find matching items during autocompletion. Previously it was O(n). We can't use a single list with a single binary search, because the list is sorted by directories first and then files.

@lhecker lhecker merged commit e779c16 into main Jun 11, 2025
3 checks passed
@lhecker lhecker deleted the dev/lhecker/insensitive-autocomplete branch June 11, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants