#[derive(Debug, Clone)]
pub struct FormatOptions {
pub tab_size: usize,
pub insert_spaces: bool,
pub print_width: usize,
}
impl Default for FormatOptions {
fn default() -> Self {
Self {
tab_size: 4,
insert_spaces: true,
print_width: 80,
}
}
}
impl FormatOptions {
pub fn indent(&self, level: usize) -> String {
if self.insert_spaces {
" ".repeat(self.tab_size * level)
} else {
"\t".repeat(level)
}
}
}