document/explain logic of ignoring --lines
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Reproduce the issue with the supplied hello.java example and the two google-java-format commands. Trace the --lines option's range handling, then document why the first line is formatted and what behavior is intended, including whether a focused-line formatting result can be achieved.
Written by the indexing model from the issue text.
Description
as seen in #942 and #1000 (and others) use of --lines does not reliably work.
I'm trying to grok how/why....
As an example:
///usr/bin/env jbang "$0" "$@" ; exit $?
import static java.lang.System.*;
public class hello {
public static void main(String... args) {
out.println("Hello World");
}
}
I want google java format to ignore the first line - reading other isseues I should --skip-* as much as possible ...
jbang com.google.googlejavaformat:google-java-format:1.28.0 --lines 2:9999 --skip-javadoc-formatting --skip-reflowing-long-strings --skip-sorting-imports --skip-removing-unused-imports hello.java
result in first line being formatted as: /// usr/bin/env jbang "$0" "$@" ; exit $?
why ?
If I add --lines 1000:9999 it works...but now the code is not formatted at all.
is this really the intended behavior of --lines ?
any way to have it not try include outside the lines requested?
- Dominant language
- Java
- Stars
- 6.2k
- Forks
- 936
- Avg merge
- 6m
- Merged PRs (30d)
- 3
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/google-java-format
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
google/google-java-format#1094 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
google/google-java-format#1450 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
google/google-java-format#1439 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
google/google-java-format#1436 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
google/google-java-format#1428 · 4 comments ·
Maintainers usually reply within 1 day
All issues in google/google-java-format
Similar issues
-
TerminalRow.mSpaceUsed (short) overflows on terminals wider than 1023 columns, crashing setCharOpen
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
termux/termux-app#5340 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
apache/rocketmq-dashboard#5110 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 4 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
TS2502 in shipped .d.ts: `compileHighlightConfig` parameter shadows the de-aliased `Query` typeOpenbug javascript
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day