pub fn detect_formatter(
path: &Path,
lang: LangId,
config: &Config,
) -> Option<(String, Vec<String>)>Expand description
Detect the appropriate formatter command and arguments for a file.
Priority per language:
- TypeScript/JavaScript/TSX:
prettier --write <file> - Python:
ruff format <file>(fallback:black <file>) - Rust:
rustfmt <file> - Go:
gofmt -w <file>
Returns None if no formatter is available for the language.