redhat-developer / redhat-developer/vscode-java

Formatter: Unexpected line breaks in braces when Record declares

Open
#3,549 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When declaring Record, if the argument of an annotation is an array (using braces), the code formatter will wrap the braces in newline, and I think it should be better not to wrap the braces in this case.

Environment
  • Operating System: macOS
  • JDK version: 17.0.10
  • Visual Studio Code version: 1.87.2 (Universal)
  • Java extension version: 1.28.1
Current Result

图片

Expected Result

图片

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 implementation files or tests are named. Reproduce the formatter behavior with a Java Record whose annotation argument is an array, then locate the formatter entry point and compare the output with the expected screenshot. Done means the braces remain on the intended line without the unexpected newline.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.