-
Notifications
You must be signed in to change notification settings - Fork 12
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
Open
Brikster
wants to merge
26
commits into
OkaeriPoland:master
Choose a base branch
from
Brikster:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
2a81f61
Implement comments for maps and collections with snakeyaml
Brikster a98eb9f
Implement comments in bungee configurer
Brikster 1aa0a9e
Remove comments limitations from README.md
Brikster 6e7cb63
Fix collections start key
Brikster e1fcfc1
Try to fix ConfigPostprocessor again
Brikster 97a3fff
Try to fix comments after multiline sections
Brikster 72a1c13
Fix building
Brikster 55df01a
Experimental comments language
Brikster 8bddf0e
Set comments language directly to config declaration
Brikster 1bc53dd
Fix settings comments language
Brikster e33a47b
Fix settings comments language again
Brikster ea9a920
Fix settings comments language again
Brikster d807689
Fix settings comments language again
Brikster 7105aeb
Fix settings comments language again
Brikster 6115644
Set language globally
Brikster 347048c
Delete old field declaration with old language
Brikster 7f56f8b
Delete old config declaration with old language
Brikster 38cd4b7
Try to fix level error mistake on multiline strings
Brikster 536ca56
Try to fix level error mistake on multiline strings
Brikster 7fcbb02
Try to fix level error mistake on multiline strings
Brikster 42cad68
Try to fix level error mistake on multiline strings
Brikster 70cba8e
Try to fix level error mistake on multiline strings
Brikster 227ea4a
Try to fix level error mistake on multiline strings
Brikster ef138c1
Try to fix level error mistake on multiline strings
Brikster 6b175fe
Try to fix level error mistake on multiline strings
Brikster 5a33076
Try to fix level error mistake on multiline strings
Brikster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,15 @@ public ConfigPostprocessor updateLinesKeys(@NonNull ConfigSectionWalker walker) | |
for (String line : lines) { | ||
|
||
int indent = countIndent(line); | ||
|
||
int collectionsStartCount = 0; | ||
while (walker.isKeyCollectionStart(line)) { | ||
collectionsStartCount++; | ||
int collectionStartCharIndex = line.indexOf(walker.getCollectionStartChar()); | ||
line = line.substring(0, collectionStartCharIndex) + ' ' + line.substring(collectionStartCharIndex + 1); | ||
indent += 2; | ||
} | ||
|
||
int change = indent - lastIndent; | ||
String key = walker.readName(line); | ||
|
||
|
@@ -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 commentThe 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. |
||
updatedLine = updatedLine.substring(0, indent - collectionsStartCount * 2) + walker.getCollectionStartChar() + updatedLine.substring(indent - collectionsStartCount * 2 + 1); | ||
collectionsStartCount--; | ||
} | ||
|
||
newContext.append(updatedLine).append("\n"); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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