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