pub fn auto_format(path: &Path, config: &Config) -> (bool, Option<String>)Expand description
Auto-format a file using the detected formatter for its language.
Returns (formatted, skip_reason):
(true, None)— file was successfully formatted(false, Some(reason))— formatting was skipped, reason explains why
Skip reasons:
"unsupported_language"— language has no formatter support in AFT"no_formatter_configured"—format_on_edit=falseor no formatter detected for the language in the project"formatter_not_installed"— configured formatter binary missing on PATH and not in project’snode_modules/.bin"formatter_excluded_path"— formatter ran but refused to process this path because the project formatter config (e.g. biome.jsonfiles.includes, prettier.prettierignore) excludes it. NOT an error in AFT or the user’s formatter — the user told the formatter not to touch this path. Agents should treat this as informational."timeout"— formatter exceededformatter_timeout_secs"error"— formatter exited non-zero with an unrecognized error (likely a real bug in the user’s input or the formatter itself)