Skip to content

Commit

Permalink
chore: rename printer setting spaces to tab_spaces for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
bram209 committed Oct 10, 2023
1 parent 974e183 commit 1bc6fcd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion formatter/src/formatter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl FormatterSettings {
pub fn to_printer_settings(&self, source: Option<&Rope>) -> PrinterSettings {
PrinterSettings {
margin: self.max_width as isize,
spaces: self.tab_spaces as isize,
tab_spaces: self.tab_spaces as isize,
min_space: 60,
crlf_line_endings: match self.newline_style {
NewlineStyle::Auto => source.map(uses_crlf_line_ending).unwrap_or_default(),
Expand Down
6 changes: 3 additions & 3 deletions printer/src/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub struct PrinterSettings {
// Target line width.
pub margin: isize,
// Number of spaces incement at each level of block indentation.
pub spaces: isize,
pub tab_spaces: isize,
// Every line is allowed at least this much space, even if highly indented.
pub min_space: isize,
// Print CRLF line ending instead of LF
Expand Down Expand Up @@ -361,8 +361,8 @@ impl Printer {
if !self.settings.hard_tabs {
self.out.reserve(self.pending_indentation);
} else {
let tabs = self.pending_indentation / self.settings.spaces as usize;
let remaining_spaces = self.pending_indentation % self.settings.spaces as usize;
let tabs = self.pending_indentation / self.settings.tab_spaces as usize;
let remaining_spaces = self.pending_indentation % self.settings.tab_spaces as usize;
self.out.reserve(tabs + remaining_spaces);
self.out.extend(iter::repeat('\t').take(tabs));
self.pending_indentation = remaining_spaces
Expand Down
10 changes: 5 additions & 5 deletions printer/src/convenience.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use std::borrow::Cow;

impl Printer {
pub fn ibox_indent(&mut self) {
self.ibox(self.settings.spaces);
self.ibox(self.settings.tab_spaces);
}

pub fn ibox_dedent(&mut self) {
self.ibox(-self.settings.spaces);
self.ibox(-self.settings.tab_spaces);
}

pub fn ibox(&mut self, indent: isize) {
Expand All @@ -18,11 +18,11 @@ impl Printer {
}

pub fn cbox_indent(&mut self) {
self.cbox(self.settings.spaces);
self.cbox(self.settings.tab_spaces);
}

pub fn cbox_dedent(&mut self) {
self.cbox(-self.settings.spaces);
self.cbox(-self.settings.tab_spaces);
}

pub fn cbox(&mut self, indent: isize) {
Expand All @@ -33,7 +33,7 @@ impl Printer {
}

pub fn end_dedent(&mut self) {
self.offset(-self.settings.spaces);
self.offset(-self.settings.tab_spaces);
self.end();
}

Expand Down

0 comments on commit 1bc6fcd

Please sign in to comment.