extract_file_paths_from_text

Function extract_file_paths_from_text 

Source
pub fn extract_file_paths_from_text(
    text: &str,
    allow_tests: bool,
) -> Vec<(PathBuf, Option<usize>, Option<usize>, Option<String>, Option<HashSet<usize>>)>
Expand description

Extract file paths from text (for stdin mode)

This function takes a string of text and extracts file paths with optional line numbers or ranges. It’s used when the extract command receives input from stdin.

The function looks for patterns like:

  • File paths with extensions (e.g., file.rs, path/to/file.go)
  • Optional line numbers after a colon (e.g., file.rs:10)
  • Optional line ranges after a colon (e.g., file.rs:1-60)
  • File paths with line and column numbers (e.g., file.rs:10:42)
  • File paths with symbol references (e.g., file.rs#function_name)
  • File paths with symbol references (e.g., file.rs#function_name)
  • Paths can be wrapped in backticks, single quotes, or double quotes

If allow_tests is false, test files will be filtered out.