Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions crates/bashkit/src/builtins/rg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,16 @@ impl RgTypeDatabase {
}

fn parse(&self, name: &str) -> Result<RgFileType> {
if name == "all" {
return Ok(RgFileType {
globs: self
.definitions
.values()
.flat_map(|globs| globs.iter().cloned())
.collect(),
});
}

let Some(globs) = self.definitions.get(name) else {
return Err(Error::Execution(format!(
"rg: unrecognized file type: {}",
Expand Down Expand Up @@ -5852,6 +5862,37 @@ mod tests {
cwd: "/",
output: RgDiffOutput::Exact,
},
RgDiffCase {
name: "type all searches recognized types",
args: &["--type", "all", "needle", "proj/lang"],
stdin: None,
files: DIFF_BASIC_FILES,
cwd: "/",
output: RgDiffOutput::UnorderedLines,
},
RgDiffCase {
name: "type all includes added custom types",
args: &[
"--type-add",
"foo:*.foo",
"--type",
"all",
"needle",
"proj/lang",
],
stdin: None,
files: DIFF_BASIC_FILES,
cwd: "/",
output: RgDiffOutput::UnorderedLines,
},
RgDiffCase {
name: "type not all searches unrecognized types",
args: &["--type-not", "all", "needle", "proj/lang"],
stdin: None,
files: DIFF_BASIC_FILES,
cwd: "/",
output: RgDiffOutput::UnorderedLines,
},
RgDiffCase {
name: "type not rust",
args: &["-T", "rust", "needle", "proj/lang"],
Expand Down