mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 15:15:33 +00:00
Rename tab-size
to indent-width
(#8082)
## Summary This PR renames the `tab-size` configuration option to `indent-width` to express that the formatter uses the option to determine the indentation width AND as tab width. I first preferred naming the option `tab-width` but then decided to go with `indent-width` because: * It aligns with the `indent-style` option * It would allow us to write a lint rule that asserts that each indentation uses `indent-width` spaces. Closes #7643 ## Test Plan Added integration test
This commit is contained in:
parent
c3dabc1933
commit
84979f9673
10 changed files with 143 additions and 49 deletions
|
@ -12,7 +12,7 @@ use ruff_source_file::{OneIndexed, SourceLocation};
|
|||
use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||
|
||||
use crate::fs::relativize_path;
|
||||
use crate::line_width::{LineWidthBuilder, TabSize};
|
||||
use crate::line_width::{IndentWidth, LineWidthBuilder};
|
||||
use crate::message::diff::Diff;
|
||||
use crate::message::{Emitter, EmitterContext, Message};
|
||||
use crate::registry::AsRule;
|
||||
|
@ -300,7 +300,7 @@ fn replace_whitespace(source: &str, annotation_range: TextRange) -> SourceCode {
|
|||
let mut result = String::new();
|
||||
let mut last_end = 0;
|
||||
let mut range = annotation_range;
|
||||
let mut line_width = LineWidthBuilder::new(TabSize::default());
|
||||
let mut line_width = LineWidthBuilder::new(IndentWidth::default());
|
||||
|
||||
for (index, c) in source.char_indices() {
|
||||
let old_width = line_width.get();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue