@@ -333,9 +333,10 @@ pub(crate) fn complete_path(
333333 }
334334
335335 if entry. metadata ( ) . map ( |m| m. is_dir ( ) ) . unwrap_or ( false ) {
336- let mut suggestion = prefix. join ( raw_file_name) ;
336+ let mut suggestion = prefix. join ( & raw_file_name) ;
337337 suggestion. push ( "" ) ; // Ensure trailing `/`
338- let candidate = CompletionCandidate :: new ( suggestion. as_os_str ( ) . to_owned ( ) ) ;
338+ let candidate = CompletionCandidate :: new ( suggestion. as_os_str ( ) . to_owned ( ) )
339+ . hide ( is_hidden ( & raw_file_name) ) ;
339340
340341 if is_wanted ( & entry. path ( ) ) {
341342 completions. push ( candidate) ;
@@ -344,8 +345,9 @@ pub(crate) fn complete_path(
344345 }
345346 } else {
346347 if is_wanted ( & entry. path ( ) ) {
347- let suggestion = prefix. join ( raw_file_name) ;
348- let candidate = CompletionCandidate :: new ( suggestion. as_os_str ( ) . to_owned ( ) ) ;
348+ let suggestion = prefix. join ( & raw_file_name) ;
349+ let candidate = CompletionCandidate :: new ( suggestion. as_os_str ( ) . to_owned ( ) )
350+ . hide ( is_hidden ( & raw_file_name) ) ;
349351 completions. push ( candidate) ;
350352 }
351353 }
@@ -357,6 +359,10 @@ pub(crate) fn complete_path(
357359 completions
358360}
359361
362+ fn is_hidden ( file_name : & OsStr ) -> bool {
363+ file_name. starts_with ( "." )
364+ }
365+
360366fn split_file_name ( path : & std:: path:: Path ) -> ( & std:: path:: Path , & OsStr ) {
361367 // Workaround that `Path::new("name/").file_name()` reports `"name"`
362368 if path_has_name ( path) {
0 commit comments