Description
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