Add sort_by_file_name config for file_picker

This commit is contained in:
cedricbuild 2024-08-28 17:21:06 +00:00
parent af7a1fd20c
commit 1f67d15196
2 changed files with 8 additions and 1 deletions

View File

@ -191,10 +191,13 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi
.git_ignore(config.file_picker.git_ignore)
.git_global(config.file_picker.git_global)
.git_exclude(config.file_picker.git_exclude)
.sort_by_file_name(|name1, name2| name1.cmp(name2))
.max_depth(config.file_picker.max_depth)
.filter_entry(move |entry| filter_picker_entry(entry, &absolute_root, dedup_symlinks));
if config.file_picker.sort_by_file_name {
walk_builder.sort_by_file_name(|name1, name2| name1.cmp(name2));
}
walk_builder.add_custom_ignore_filename(helix_loader::config_dir().join("ignore"));
walk_builder.add_custom_ignore_filename(".helix/ignore");

View File

@ -197,6 +197,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>,
/// Sort File names
/// File Picker will not when, it is set to true.
pub sort_by_file_name: bool,
}
impl Default for FilePickerConfig {
@ -211,6 +214,7 @@ fn default() -> Self {
git_global: true,
git_exclude: true,
max_depth: None,
sort_by_file_name: false,
}
}
}