Skip to content
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

Allow max number of files seen by file_picker to be configurable #5320

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions book/src/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,10 @@ Valid values for these options are `block`, `bar`, `underline`, or `hidden`.

### `[editor.file-picker]` Section

Sets options for file picker and global search. All but the last key listed in
the default file-picker configuration below are IgnoreOptions: whether hidden
files and files listed within ignore files are ignored by (not visible in) the
helix file picker and global search. There is also one other key, `max-depth`
available, which is not defined by default.
Sets options for file picker and global search. Except `max-depth` and `max-
files`, all keys listed in the default file-picker configuration below are
IgnoreOptions: whether hidden files and files listed within ignore files are
ignored by (not visible in) the helix file picker and global search.

All git related options are only enabled in a git repository.

Expand All @@ -155,6 +154,7 @@ All git related options are only enabled in a git repository.
|`git-global` | Enables reading global .gitignore, whose path is specified in git's config: `core.excludefile` option. | true
|`git-exclude` | Enables reading `.git/info/exclude` files. | true
|`max-depth` | Set with an integer value for maximum depth to recurse. | Defaults to `None`.
|`max-files` | Cap on number of files to consider. Ignored in a git repository. | Defaults to `100_000`.

### `[editor.auto-pairs]` Section

Expand Down
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 mut files: Vec<PathBuf> = 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()
};
files.sort();

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