Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mjkpolo committed Nov 28, 2024
1 parent e1d1a5c commit 6089759
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2423,6 +2423,13 @@ fn global_search(cx: &mut Context) {
let injector = injector.clone();
async move {
let searcher = SearcherBuilder::new()
.heap_limit(
if let Some(max_heap_usage) = config.file_picker_config.max_heap_usage {
Some(max_heap_usage * 1024 * 1024)
} else {
None
}
)
.binary_detection(BinaryDetection::quit(b'\x00'))
.build();
WalkBuilder::new(search_root)
Expand Down
4 changes: 4 additions & 0 deletions helix-view/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ pub struct FilePickerConfig {
/// WalkBuilder options
/// Maximum Depth to recurse directories in file picker and global search. Defaults to `None`.
pub max_depth: Option<usize>,
// SearcherBuilder options
// Maximum heap memory to use for searching in MB
pub max_heap_usage: Option<usize>,
}

impl Default for FilePickerConfig {
Expand All @@ -212,6 +215,7 @@ impl Default for FilePickerConfig {
git_global: true,
git_exclude: true,
max_depth: None,
max_heap_usage: None,
}
}
}
Expand Down

0 comments on commit 6089759

Please sign in to comment.