redhat-developer / redhat-developer/vscode-java

Eclipse Formatter settings for comment length ignored

Abierto
#3,394 6 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

caused-by-extension formatter
Lenguaje dominante
TypeScript
Estrellas
2.3k
Forks
546
Merge medio
20 h 1 min
PR fusionados (30 d)
11

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el problema con un archivo XML de Eclipse Formatter y el comando Java: Open Java Formatter Settings with Preview, comparando org.eclipse.jdt.core.formatter.comment.line_length con comment_line_length. Rastrea cómo se cargan y aplican las configuraciones del formatter; se considera terminado cuando los comentarios usan el valor de Eclipse JDT cuando está presente, incluidos los valores distintos de 80.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java, typescript
Área
developer-experience, tooling
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.