Merge --lines ranges that overlap instead of rejecting them by abashev · Pull Request #71 · openjavaformat/open-java-format · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableRangeSet;
import com.google.common.collect.Range;
import com.google.common.collect.RangeSet;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
Expand Down Expand Up @@ -212,7 +213,7 @@ private static Range<Integer> parseCharacterRange(String range) {
* --lines flags or separated by commas. A single line can be set by a single number. Line numbers are
* {@code 1}-based, but are converted to the {@code 0}-based numbering used internally by google-java-format.
*/
private static void parseRangeSet(ImmutableRangeSet.Builder<Integer> result, String ranges) {
private static void parseRangeSet(RangeSet<Integer> result, String ranges) {
for (String range : COMMA_SPLITTER.split(ranges)) {
result.add(parseRange(range));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ final class UsageException extends Exception {
" --set-exit-if-changed",
" Return exit code 1 if there are any formatting changes.",
" --lines, -lines, --line, -line",
" Line range(s) to format, like 5:10 (1-based; default is all).",
" Line range(s) to format, e.g. the first 5 lines are 1:5 (1-based; default is all).",
" --character-ranges, -character-ranges, --character-range, -character-range",
" character range(s) to format, like 5:10 (0-based; default is all).",
" --offset, -offset",
Expand Down
Loading