-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments outside of code block #1862
Comments
This came up when we were contributing to SwiftPoet, too. Part of the problem is that we reserve the right to re-arrange the order of members added to a type. Additionally, we might collapse a member into a primary constructor, such as when it forms a primary constructor property. I don't have a good way to reconcile this behavior with regions. For non-collapsing members we could group by region and then perform our ordering. But that also might change the initialization order of default values and break compilation. I don't see a clear path to supporting this, unfortunately. |
Is your feature request related to a problem? Please describe.
IntelliJ (and probably other editors) support
editor-fold
comments to collapse stuff that probably is not so interesting to look at to get an overview: https://www.jetbrains.com/guide/java/tips/editor-fold/In our code, we have generated data classes where when we go into the generated code, we are only really interested in the primary constructor parameter list, to see whats inside the dataclass. All the other stuff (annotations, additional constructors, etc. are not really interesting to look at when everything runs smoothly).
In our case, we have the primary constructor private to prevent code to use non-named parameter constructor calls.
Example:
This would collapse in the IDE like this:
constructors cannot be extension methods, otherwise I would move the clutter into an extension method to keep the data classes as clean as possible. Also annotations can be quite extensive and they cannot be moved somewhere else, as far as I know
Describe the solution you'd like
Something like this would be nice:
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: