docs: document isdir nuance when prefix matching

This commit is contained in:
Himadri Bhattacharjee 2024-07-14 21:34:56 +05:30
parent bf3b6c7a84
commit e3db29b1b6
No known key found for this signature in database

View File

@ -76,6 +76,13 @@ fn complete_rec(
completions.push(built);
}
}
// isdir tells us whether the current path has a trailing slash.
// Parsing a path string into a pathbuf loses that bit of information.
// We use isdir to confirm that the current component has at least one
// next component or a slash.
// This acts as a confirmation to ignore longer completions for components
// in between.
if entry_name.eq(base)
&& matches!(options.match_algorithm, MatchAlgorithm::Prefix)
&& isdir