Skip to main content

Crate adam_fmt

Crate adam_fmt 

Source
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§

FormatFileError
Describes an I/O failure or retains the source and diagnostic for refused formatting.

Functions§

format_file
Formats the adam-lang source file at path in place.
render_error
Renders error as a human-readable diagnostic naming path, using rustc-style source snippets for a FormatFileError::Format.