palantir / palantir/palantir-java-format
Keep //region [something] and //endregion code folding comments as it
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 907
- Forks
- 101
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 19
Description
What happened?
Some IDE (as Jetbrains ones) allow usage of special comments to create custom foldable regions in code. This supports two common syntaxes (see this article):
//region Custom fold descriptionand//endregion(from Microsoft Visual Studio)//<editor-fold desc="Custom fold description">and//</editor-fold>(from Netbeans)
palantir-java-format will reformat these comments with spaces after //. //<editor-fold desc="Custom fold description"> and //</editor-fold> syntax will continue to work, but // region Custom fold description and // endregion (with spaces) are no more detected as custom foldable comments.
What did you want to happen?
//region Custom fold description and //endregion comments may be let as-is (at least don’t add space between comment start // and region and endregion keywords) to prevent breaking custom fold sections.
There is always the alternative to use the Netbeans syntax, but this one is lighter, easier to remember and read.
I don’t know how it would be hard to do, if this behaviour appears to be desirable. I can do a pull request if there is any hit to do this kind of stuff.
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
No files, tests, or entry points are named. Start by locating the formatter logic that inserts a space after //, then find its comment-formatting tests and add coverage for //region and //endregion; done means those markers remain unchanged while ordinary comments still format normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100