redhat-developer / redhat-developer/vscode-java

.xml formatter file is ignored

Open
#2,798 5 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug configuration formatter
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

.xml formatter file is ignored when formatting files through vscode. (meybe default value used)
The project folder is opened in docker container.
eclipse-java-google-style.xml is created as bellow.

  1. copy and paset from https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml
  2. change comment.line_length and lineSplit
Environment
  • Operating System: Windows11
  • JDK version: openjdk version "1.8.0_352"
  • Visual Studio Code version: 1.73.1
  • Java extension version: Language Support for Java(TM) by Red Hat v1.12.0
Steps To Reproduce

settings.json

"java.format.settings.url": ".vscode/eclipse-java-google-style.xml",
"java.format.settings.profile": "GoogleStyle",

eclipse-java-google-style.xml

<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="30"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="999"/>

log

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-11-14 17:46:16.037
!MESSAGE >> New configuration: {java=...format={enabled=true, settings={url=.vscode/eclipse-java-google-style.xml, profile=GoogleStyle}...}
Current Result
	// the example of long comment and method aaaa aaaa aaaa aaaa aaaa aaaa aaaa
	// aaaa aaaa aaaa aaaa aaaa aaaa
	private void examplePrintNumber(int firstExamplePrintNumber, int secondExmaplePrintNumber,
			int thirdExamplePrintNumber, int fourthExamplePrintNumber, int fifthExamplePrintNumber) {
		System.out.println(firstExamplePrintNumber + secondExmaplePrintNumber + thirdExamplePrintNumber
				+ fourthExamplePrintNumber + fifthExamplePrintNumber);
	}
Expected Result
	// the example of long comment and method
	// aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa
	// aaaa aaaa aaaa aaaa aaaa
	private void examplePrintNumber(int firstExamplePrintNumber, int secondExmaplePrintNumber, int thirdExamplePrintNumber, int fourthExamplePrintNumber, int fifthExamplePrintNumber) {
		System.out.println(firstExamplePrintNumber + secondExmaplePrintNumber + thirdExamplePrintNumber + fourthExamplePrintNumber + fifthExamplePrintNumber);
	}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the formatter behavior in a VS Code dev container using settings.json and .vscode/eclipse-java-google-style.xml, with the reported comment.line_length and lineSplit values. Compare the current and expected formatting output; done when the XML formatter settings are honored instead of the default values.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.