@@ -15,6 +15,7 @@ mod statusline;
17use crate::compositor::{Component, Compositor};
17use crate::compositor::{Component, Compositor};
18+use crate::filter_picker_entry;
18use crate::job::{self, Callback};
19use crate::job::{self, Callback};
19pub use completion::Completion;
20pub use completion::Completion;
20pub use editor::EditorView;
21pub use editor::EditorView;
@@ -163,6 +164,9 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi
164 let now = Instant::now();
165 let now = Instant::now();
167+ let dedup_symlinks = config.file_picker.deduplicate_links;
168+ let absolute_root = root.canonicalize().unwrap_or_else(|_| root.clone());
166 let mut walk_builder = WalkBuilder::new(&root);
170 let mut walk_builder = WalkBuilder::new(&root);
167 walk_builder
171 walk_builder
168 .hidden(config.file_picker.hidden)
172 .hidden(config.file_picker.hidden)
@@ -173,10 +177,7 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi
173 .git_global(config.file_picker.git_global)
177 .git_global(config.file_picker.git_global)
174 .git_exclude(config.file_picker.git_exclude)
178 .git_exclude(config.file_picker.git_exclude)
175 .max_depth(config.file_picker.max_depth)
179 .max_depth(config.file_picker.max_depth)
176− // We always want to ignore the .git directory, otherwise if
177− // `ignore` is turned off above, we end up with a lot of noise
179− .filter_entry(|entry| entry.file_name() != ".git");
180+ .filter_entry(move |entry| filter_picker_entry(entry, &absolute_root, dedup_symlinks));
181 // We want to exclude files that the editor can't handle yet
182 // We want to exclude files that the editor can't handle yet
182 let mut type_builder = TypesBuilder::new();
183 let mut type_builder = TypesBuilder::new();
@@ -195,14 +196,11 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi
195 // We want files along with their modification date for sorting
196 // We want files along with their modification date for sorting
196 let files = walk_builder.build().filter_map(|entry| {
197 let files = walk_builder.build().filter_map(|entry| {
197 let entry = entry.ok()?;
198 let entry = entry.ok()?;
199 // This is faster than entry.path().is_dir() since it uses cached fs::Metadata fetched by ignore/walkdir
199 // This is faster than entry.path().is_dir() since it uses cached fs::Metadata fetched by ignore/walkdir
200− let is_dir = entry.file_type().map_or(false, |ft| ft.is_dir());
200+ if entry.file_type()?.is_file() {
202− // Will give a false positive if metadata cannot be read (eg. permission error)
205 Some(entry.into_path())
201 Some(entry.into_path())