redhat-developer / redhat-developer/vscode-java

Java Formatter settings are not used

Open
#3,020 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

If I open the flow-server project from https://github.com/vaadin/flow/tree/main/flow-server

and have Eclipse formatter settings set to use https://raw.githubusercontent.com/vaadin/flow/main/eclipse/VaadinJavaConventions.xml which defines <setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
image

then when I open e.g. the HandlerHelperTest.java file, VS Code shows "Spaces: 8" in the bottom bar and formatting the file changes it to use indentation of 8 spaces instead of 4

The settings file should be fine because when I go back to command line and run mvn formatter:format in the project, the indentation is changed back to 4 spaces.

Environment
  • Operating System: macOs Ventura
  • JDK version: 17
  • Visual Studio Code version: 1.76.2
  • Java extension version: 1.16.0
Steps To Reproduce
  1. See above
Current Result

File is not formatted according to given settings

Expected Result

File is formatted according to given settings

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 issue by opening flow-server with VaadinJavaConventions.xml configured in VS Code, then compare formatting HandlerHelperTest.java with the result of mvn formatter:format. Trace how the Java extension reads and applies formatter settings. Done means VS Code uses the configured four-space indentation consistently with the Maven formatter.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.