jhipster / jhipster/prettier-java

Continuation Indent

Offen
#429 1 Kommentar 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
1.2k
Forks
120
Ø Merge
1 T. 14 Std.
Gemergte PRs (30 T.)
27

Beschreibung

**Prettier-Java ^0.8.0**

```sh
# Options (if any):
--print-width 80
```

**Input:**

```java
// code snippet
public class Test {

public void testMethod(final String param1, final String param2) throws Exception {
throw new Exception("blah");
}

}
```

**Output:**

> Note that `throws` and `throw` appear at the same indentation.

```java
// code snippet
public class Test {

public void testMethod(final String param1, final String param2)
throws Exception {
throw new Exception("blah");
}
}
```

**Expected behavior:**

When `throws` is wrapped, it seems like it should be more clearly separated from code inside the method.

One option is to use one additional indentation any time a line is wrapped, but open to alternatives:
```
public class Test {

public void testMethod(final String param1, final String param2)
throws Exception {
throw new Exception("blah");
}
}
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduce the reported formatting with Prettier-Java 0.8.0 and --print-width 80 using the Java input and expected output in this issue. Find the formatter logic handling a wrapped throws clause, then add coverage showing that its continuation indentation is distinct from the method body indentation.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.