Expand description
adam-fmt’s core: reads one adam-lang .adm2 file, formats it with
[adam_lang::format_source] — the same logic adam-lsp’s textDocument/formatting handler
uses, so adam-fmt and an editor’s “Format Document” agree exactly — and writes the result
back in place, only touching the file when its contents actually change.
§Example
use std::path::Path;
let path = Path::new("sheet.adm2");
match adam_fmt::format_file(path) {
Ok(true) => println!("formatted"),
Ok(false) => println!("already formatted"),
Err(error) => eprint!("{}", adam_fmt::render_error(path, &error)),
}Enums§
- Format
File Error - Describes an I/O failure or retains the source and diagnostic for refused formatting.
Functions§
- format_
file - Formats the adam-lang source file at
pathin place. - render_
error - Renders
erroras a human-readable diagnostic namingpath, usingrustc-style source snippets for aFormatFileError::Format.