-
Notifications
You must be signed in to change notification settings - Fork 11
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
Implement comments for maps and collections with snakeyaml #34
base: master
Are you sure you want to change the base?
Conversation
@@ -6,9 +6,9 @@ | |||
<parent> | |||
<groupId>eu.okaeri</groupId> | |||
<artifactId>okaeri-configs</artifactId> | |||
<version>4.0.6</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No project version bumps please
@@ -169,6 +178,12 @@ public ConfigPostprocessor updateLinesKeys(@NonNull ConfigSectionWalker walker) | |||
|
|||
lastIndent = indent; | |||
String updatedLine = walker.update(line, currentPath.get(currentPath.size() - 1), currentPath); | |||
|
|||
while (collectionsStartCount != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic changes in this class are really convoluted and have a lot of mutation based whiles. This needs better structure, should be very much doable with at least semi-simple result.
Including comments in each map/collection element is messy and confusing for the end user. It should be only in the first one. |
Would be better, if it would be configurable |
Fix issue #17.
Rewritten
ConfigPostprocessor
to provide first line of collection to a walker (previously, lines that begins from "-" were written as is).YamlSectionWalker
's implementations now resolve subtypes of Map and Collection and append comments of their fields.Now there is an ability to create commented Lists, Maps, Lists of Maps, Maps of Lists etc.
Here you can see an example:
And config file: