redhat-developer / redhat-developer/vscode-java
Eclipse Formatter settings for comment length ignored
Personne n'a encore pris cette issue.
- Langage dominant
- TypeScript
- Étoiles
- 2.3k
- Forks
- 546
- Merge moyen
- 20 h 1 min
- PR mergées (30 j)
- 11
Description
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"/>
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
- Create an Eclipsed Formatter XML file containing the setting
org.eclipse.jdt.core.formatter.comment.line_lengthwith a value different than80. - Write a comment that goes over
80or the value set for the property above. - Format the code and see the comment being limited to
80despite 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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Reproduisez le problème avec un fichier XML Eclipse Formatter et la commande Java: Open Java Formatter Settings with Preview, en comparant org.eclipse.jdt.core.formatter.comment.line_length à comment_line_length. Suivez la manière dont les paramètres du formatter sont chargés et appliqués ; le travail est terminé lorsque les commentaires utilisent la valeur Eclipse JDT lorsqu’elle est présente, y compris les valeurs autres que 80.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java, typescript
- Domaine
- developer-experience, tooling
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100