Skip to main content

expand_directory_pattern

Function expand_directory_pattern 

Source
pub fn expand_directory_pattern(pattern: &str) -> Vec<String>
Expand description

Expands directory-style patterns to also match files within them. Pattern “dir/path” becomes [“dir/path”, “dir/path/**”] to match both the directory itself and all contents recursively. A leading ~ is expanded first (see expand_home_prefix).

The expansion is driven by the pattern’s final component: it names a directory only when it holds no wildcard. docs/* therefore stays as written (it names direct children, and docs/*/** would newly exclude nested contents), while **/.cursor/plans gains its contents-expansion despite the wildcard earlier in the pattern.