pub mod check;
pub use badness_formatter::formatter::*;
pub use check::{ChangedFile, CheckError, CheckResult, check_paths, check_paths_with_style};
use crate::parser::{LexConfig, parse_with_flavor};
use crate::semantic::disk_scope_signatures;
pub fn format_file_with_packages(
content: &str,
path: &std::path::Path,
style: FormatStyle,
config: impl Into<LexConfig>,
) -> Result<String, FormatError> {
format_file_with_packages_sentence(content, path, style, config, SentenceOptions::default())
}
pub fn format_file_with_packages_sentence(
content: &str,
path: &std::path::Path,
style: FormatStyle,
config: impl Into<LexConfig>,
sentence: SentenceOptions<'_>,
) -> Result<String, FormatError> {
let parsed = parse_with_flavor(content, config);
if !parsed.errors.is_empty() {
return Err(FormatError::ParseErrors {
count: parsed.errors.len(),
});
}
let root = parsed.syntax();
let external = disk_scope_signatures(&root, path);
format_node_with_signatures_sentence(&root, style, &external, sentence)
}