google / google/google-java-format
document/explain logic of ignoring --lines
- 主要語言
- Java
- 星號
- 6.2k
- 分支
- 936
- 平均合併
- 6 分鐘
- 30 天內合併 PR
- 3
描述
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:
```hello.java
///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?
貢獻指南
研究方向
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.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java
- 領域
- cli, tooling
- Issue 類型
- 文件
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100