redhat-developer / redhat-developer/vscode-java

Eclipse Formatter settings for comment length ignored

Aperta
#3,394 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

caused-by-extension formatter
Lingua principale
TypeScript
Stelle
2.3k
Fork
546
Merge medio
20h 1m
PR unite (30g)
11

Descrizione

I have a custom, Eclipse Formatter XML preference file that includes the following Eclipse JDT formatter setting for comment length:

<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>

I have noticed that, when formatting the code using this settings, comments were always formatted to 80 columns, regardless of the value used. When opening > Java: Open Java Formatter Settings with Preview using the Command Palette, and navigating to the comment section, I noticed that the value in Maximum comment line length is set to 80 -- check out the image below. When modifying this value, my XML file is updated to include the following setting:

<setting id="comment_line_length" value="120"/>

image

It seems that the formatter is picking up its default setting for line length, which is a property name different than the Eclipse JDT Core formatter setting.

Environment
  • Operating System: Amazon Linux 2 (running through SSH)
  • JDK version: 8
  • Visual Studio Code version: the latest (Nov 2023 release)
  • Java extension version: v1.24.0
Steps To Reproduce
  1. Create an Eclipsed Formatter XML file containing the setting org.eclipse.jdt.core.formatter.comment.line_length with a value different than 80.
  2. Write a comment that goes over 80 or the value set for the property above.
  3. Format the code and see the comment being limited to 80 despite the value used in the property above.
Current Result

Comments are formatted to the default value set by comment_line_length instead of the value set by org.eclipse.jdt.core.formatter.comment.line_length.

Expected Result

Comments should be formatted using org.eclipse.jdt.core.formatter.comment.line_length when available.

Additional Informations

Likely related to https://github.com/redhat-developer/vscode-java/issues/2798

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Riproduci il problema con un file XML di Eclipse Formatter e il comando Java: Open Java Formatter Settings with Preview, confrontando org.eclipse.jdt.core.formatter.comment.line_length con comment_line_length. Traccia come vengono caricate e applicate le impostazioni del formatter; il lavoro è completato quando i commenti usano il valore di Eclipse JDT quando è presente, inclusi i valori diversi da 80.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.