redhat-developer / redhat-developer/vscode-java

Formatting a java source file results in a weird presentation

Open
#2,882 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

After update the extension to version 1.13.0. I get weird code formatting results.

Environment
  • Operating System: RockyLinux 8.6
  • JDK version: openjdk 17.0.5
  • Visual Studio Code version: 1.74.3
  • Java extension version: 1.13.0
Steps To Reproduce
  1. Start of with a file. any file.
  2. Fiddle around the file ie: putting 2 imports on the same line
  3. Add some tabs before another import
  4. run the formatter (right-click and format this document)
Current Result

After Upgrading to 1.13.0
After upgrading to 1 13 0

After running the formatter I end up with this
image

Same formatter output, but with some tabs to show the the indentation isn't aligning properly.
image

Expected Result

The indentation should always be exact!

Additional Informations

I also have the Spring boot extensions installed.
After updating to version 1.13.0, I get some visual cues that my file contains a Spring Bean.

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

No source files, tests, or entry points are named. Reproduce the formatting case in the stated VS Code, Java extension, JDK, and Rocky Linux environment, then trace the Java formatter integration to identify why imports and indentation are misaligned. Done means formatting produces consistently exact indentation without the reported visual cues.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.