redhat-developer / redhat-developer/vscode-java

Java formatter ignores org.eclipse.jdt.core.formatter.tabulation.size and uses editor's 'tab size' when calculating line split

Abierto
#3,513 5 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

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

Descripción

Java formatter ignores org.eclipse.jdt.core.formatter.tabulation.size and uses editor's 'tab size' when calculating how lines should be split. This makes it difficult for users to use their preferred indentation size without throwing off source control history diffs.

Environment
  • JDK version: openjdk version "17.0.10" 2024-01-16 LTS
  • Visual Studio Code version: 1.86.2
  • Java extension version: 1.28.1
Steps To Reproduce

Relevant settings:

  • Java formatter <setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/> and <setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/> in my java formatter
    (full formatting file: java-formatter.xml.txt))
  • VS Code set to tab size: 4

If I have a line that is 121 characters, the formatter will wrap appropriately. However, if someone else has their tab size:2, the total line length is calculated to be less than 120, and thus will unwrap the lines wich throws off the file history diffs.

Current Result

Line split is calculated based on VS Code's tab size setting, instead of the formatter's tabulation.size

Expected Result

Line split should be calculated based on the tabulation.size setting, to allow users to have their preferred tab size within VS Code

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

Comienza reproduciendo el comportamiento del formateador con la configuración proporcionada de lineSplit y tabulation.size, variando el tamaño de tabulación de VS Code. Rastrea dónde se calcula la longitud de línea del formateador de Java y verifica el resultado con Expected Result: la división de líneas debe usar tabulation.size en lugar del tamaño de tabulación del editor.

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

Evaluación

Stack tecnológico
java, vscode
Á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
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.