openrewrite / openrewrite/rewrite
Make AutoFormat ignore certain blocks
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
In our projects we sometimes use a special comment to prevent our IDEs from formatting certain blocks:
//@formatter:off
Pageable pageable = this.privilegeSortMapping
.chunkToPageable(new Chunk(0, Integer.MAX_VALUE,
List.of(new Chunk.Order("entity", Sort.Direction.ASC),
new Chunk.Order("name", Sort.Direction.ASC))),
language);
//@formatter:on
Sometimes the manuall formatting is prettier/more readable than the automatically formatted code. I think it would be cool if the AutoFormat-Recipe could be configured to turn formatting off in some cases.
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
Start by locating the AutoFormat-Recipe entry point and its existing configuration and tests; the issue does not name specific files. Trace how formatting is applied around comments, then define completion as a configurable way for formatter-off and formatter-on blocks to remain unchanged and covered by tests.
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
- 38/100