microsoft / microsoft/vscode-java-pack

Feature request, java language formatter selective comment text reflow

Aperta
#891 6 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@CsCherrYY ci sta già lavorando.

Dal 11/2/2022.

ai-triaged enhancement feature-request formatter
Lingua principale
TypeScript
Stelle
352
Fork
166
Merge medio
17h 47m
PR unite (30g)
32

Descrizione

Suggestion

I noticed the java formatter will treat different types of comments different ways. For example, it automatically reflows text on the /* */ comments, but it doesn't have the same behavior on // comments where it will preserve even its own previous line breaks, which can get annoying. Is there perhaps a way we could do something like have it not reflow // comments at all and only reflow /* */ comments? Or perhaps even ignore // comments altogether for formatting purposes while still adjusting /* */ comments?

Use Cases

When I want to simply comment out code, but leave its indentation intact for later purposes, I like to just use the ctrl-/ shortcut, but formatting the code using alt-shift-f removes the indentations. I realize there is an extension feature to disable this behavior, but unfortunately, that also disables the text reflow in the javadoc comments as well as some other comments where I'd like the reflow to happen automatically upon formatting.

Examples

So for example, if I comment out this code:

// if (true) {
//     return true;
// }

I would like that formatting to be retained. However, I'd also like it if the autoformat would automatically re-flow comments that are so long that they extend beyond the window width, and I could mark those with /* */. So for example, it would auto re-flow this sentence like this:

  /*
   * I would like that formatting to be retained. However, I'd also like it if the autoformat
   * would automatically re-flow comments that are so long that they extend beyond the window
   * width, and I could mark those with . So for example, it would re-flow this sentence like
   * this:
   */

#204

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.