redhat-developer / redhat-developer/vscode-java
Add formatter options to format multiple parameters with new lines
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
I'd like my code to be formatted with new lines for annotation, constructor or method call or declaration with multiple parameters.
For instance:
@Parameter(
in = ParameterIn.PATH,
name = "resourceName",
description = "Resource Name",
required = true,
example = "1",
schema = @Schema(type = SchemaType.STRING, minLength = 1)
)
Current formatter makes a one-liner like this:
@Parameter(in = ParameterIn.PATH, name = "resourceName", description = "Resource Name", required = true, example = "1", schema = @Schema(type = SchemaType.STRING, minLength = 1))
So the formatter should insert new line after the opening brace and comma and before the closing brace.
Environment
- Operating System: MacOs Monterey 12.3
- JDK version: openjdk version "11.0.15" 2022-04-19
- Visual Studio Code version: 1.67.2
- Java extension version: v1.6.0
Steps To Reproduce
- Add annotation with multiple parameters
- Format the code
- In my current formatter version it should compact it to one line
Current Result
@Parameter(in = ParameterIn.PATH, name = "resourceName", description = "Resource Name", required = true, example = "1", schema = @Schema(type = SchemaType.STRING, minLength = 1))
Expected Result
@Parameter(
in = ParameterIn.PATH,
name = "resourceName",
description = "Resource Name",
required = true,
example = "1",
schema = @Schema(type = SchemaType.STRING, minLength = 1)
)
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
Reproduce the formatter behavior with the annotation example and inspect the formatter entry point and its existing option handling. The work is complete when configurable formatting places parameters on separate lines after the opening delimiter and commas, before the closing delimiter, with the expected indentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100