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
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the formatter behavior with the supplied lineSplit and tabulation.size settings, varying VS Code's tab size. Trace where the Java formatter's line length is calculated and verify the result against the Expected Result: line splitting should use tabulation.size rather than the editor's tab size.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100