Skip to main content

build_file_types

Function build_file_types 

Source
pub fn build_file_types(
    select: &[String],
    negate: &[String],
) -> Result<Option<Arc<Types>>, FileTypeError>
Expand description

Build a file-type filter from rg-style type names.

Returns Ok(None) when both lists are empty (no filtering configured). select is a whitelist (only matching files pass); negate excludes matching files; both may be combined per ripgrep semantics. Unknown names are an error — never a silent empty match.

The returned Types goes straight into WalkOptions::types; the walker applies it per-file and leaves directories untraversed-through (a Types match on a directory is always None, so traversal is unaffected).