Skip to content

Commit

Permalink
feat(term, view): allow max number of files seen by file_picker to be…
Browse files Browse the repository at this point in the history
… configurable

Fixes helix-editor#5157
  • Loading branch information
nstinus committed Dec 15, 2022
1 parent 012fc12 commit e205266
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions helix-term/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi
let files: Vec<_> = if root.join(".git").exists() {
files.collect()
} else {
// const MAX: usize = 8192;
const MAX: usize = 100_000;
files.take(MAX).collect()
files.take(config.file_picker.max_files).collect()
};

log::debug!("file_picker init {:?}", Instant::now().duration_since(now));
Expand Down
3 changes: 3 additions & 0 deletions helix-view/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ pub struct FilePickerConfig {
/// WalkBuilder options
/// Maximum Depth to recurse directories in file picker and global search. Defaults to `None`.
pub max_depth: Option<usize>,
/// Cap on number of files to consider. Default is 100_000. Ignored in a git repository.
pub max_files: usize,
}

impl Default for FilePickerConfig {
Expand All @@ -111,6 +113,7 @@ impl Default for FilePickerConfig {
git_global: true,
git_exclude: true,
max_depth: None,
max_files: 100_000,
}
}
}
Expand Down

0 comments on commit e205266

Please sign in to comment.