Open JeffFaer opened 7 months ago
There's some logic in keep-sorted to try and gracefully handle lists that don't have a final trailing comma like
ImmutableList.of( // keep-sorted start 1, 3, 2 // keep-sorted end );
would become the following (commas added and removed as necessary)
ImmutableList.of( // keep-sorted start 1, 2, 3 // keep-sorted end );
https://github.com/google/keep-sorted/blob/62dd1440b1c8456b372bff09161ea9d847247671/keepsorted/block.go#L338-L340
There's a couple edge cases here that aren't handled very well right now
Trailing comments after a comma
This prevents the special case from being triggered
ImmutableList.of( // keep-sorted start 1, 3, // three 2 // keep-sorted end );
would become
ImmutableList.of( // keep-sorted start 1, 2 3, // three // keep-sorted end );
Trailing comment after the last line
The logic still triggers, but we add a comma to the comment
ImmutableList.of( // keep-sorted start 1, 3, 2 // two // keep-sorted end );
ImmutableList.of( // keep-sorted start 1, 2 // two, 3 // keep-sorted end );
There's some logic in keep-sorted to try and gracefully handle lists that don't have a final trailing comma like
would become the following (commas added and removed as necessary)
https://github.com/google/keep-sorted/blob/62dd1440b1c8456b372bff09161ea9d847247671/keepsorted/block.go#L338-L340
There's a couple edge cases here that aren't handled very well right now
Trailing comments after a comma
This prevents the special case from being triggered
would become
Trailing comment after the last line
The logic still triggers, but we add a comma to the comment
would become