-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature request: Support sorting only opted-in blocks within a file #9
Comments
Thanks for the suggestions. I think it'd be good to make a separate issue for the two suggestions, since they're not really related. I think the block thing wouldn't be too hard to do. I wonder if instead of accepting an arbitrary start and end comment we could just add some sort of
And the same regex for This would be simpler to implement and simpler to document. Do you there's a lot of value in letting users specify there own block delimiter text? |
I don't think it needs to be fully custom but I'd prefer it to be generic rather than specifying "omegasort". I'd like it to be case insensitive so people can follow their own style preference. I think it should take the comment prefix into account if that's going to be part of the regex. These are all nice to haves, though. I'd be thrilled to have something that covers this use case no matter what the details are. |
Are you interested in receiving a PR for this? I'm not sure but I might have time to work on it. |
Sure, that'd be great. But just for the blocks piece. I'd prefer to consider the other part separately. |
When writing code, it's fairly common to have blocks that should be sorted. Something like:
It would be great to be able to take advantage of
--comment-prefix
and I haven't found any other tools that can do this. Example:Then I would run it like:
Bonus points for allowing to specify a prefix or suffix that needs to appear on all lines but the last, e.g. for languages that don't allow a trailing
,
or constructs like type unions where you can't have a trailing|
:Note that it would be important to support either prefix or suffix to ensure conformance with code formatters, which might require this to be written as:
The text was updated successfully, but these errors were encountered: