jhipster / jhipster/prettier-java

Continuation Indent

Aperta
#429 1 commento 3 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
1.2k
Fork
120
Merge medio
1g 14h
PR unite (30g)
27

Descrizione

**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");
}
}
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.