diff --git a/crates/ruff/Cargo.toml b/crates/ruff/Cargo.toml index c658143fc85c9..ccd6a507e2cbd 100644 --- a/crates/ruff/Cargo.toml +++ b/crates/ruff/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ruff" -version = "0.2.0" +version = "0.2.1" publish = false authors = { workspace = true } edition = { workspace = true } diff --git a/crates/ruff/src/args.rs b/crates/ruff/src/args.rs index e93bff2ce7c58..33feeeff3c232 100644 --- a/crates/ruff/src/args.rs +++ b/crates/ruff/src/args.rs @@ -447,18 +447,17 @@ pub struct FormatCommand { #[clap(long, overrides_with("preview"), hide = true)] no_preview: bool, - /// Format code in the given . + /// Formats code in the specified range. When specified, Ruff will try to only format the code in the given range but + /// it might be necessary to extend the start backwards or the end forwards, e.g. to the start or end of the logical line. /// - /// The uses the format `:-`. + /// The `` uses the format `:-`. + /// The column numbers are the unicode codepoint from the beginning of the line. /// + /// * The line and column numbers are 1 based. /// * The end position is exclusive. - /// * The line and column numbers start at 1. - /// * The column numbers are optional, so you can write `--range=1-2` instead of `--range=1:1-2:1` - /// * The end position is optional, so you can write `--range=2` to format the entire document starting from the second line. - /// * The start position is optional, so you can write `--range=-3` to format the first three lines of the document. - /// - /// When specified, Ruff will try to only format the code in the given range but - /// it might be necessary to extend the start backwards or the end forwards, e.g. to the start or end of the logical line. + /// * The column numbers are optional. You can write `--range=1-2` instead of `--range=1:1-2:1` + /// * The end position is optional. You can write `--range=2` to format the entire document starting from the second line. + /// * The start position is optional. You can write `--range=-3` to format the first three lines of the document. /// /// The option can only be used when formatting a single file. Range formatting of notebooks is unsupported. #[arg(long)] diff --git a/docs/configuration.md b/docs/configuration.md index cacd5cff3b4e2..3ca96c6bd50d1 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -654,7 +654,10 @@ Options: Enable preview mode; enables unstable formatting. Use `--no-preview` to disable --range - Format code in the given + Formats code in the specified range. When specified, Ruff will try to + only format the code in the given range but it might be necessary to + extend the start backwards or the end forwards, e.g. to the start or + end of the logical line -h, --help Print help (see more with '--help')