Preserve inline comments when moving YAML properties and relocate doc… - #8701
Open
KamilPatora wants to merge 5 commits into
Open
Preserve inline comments when moving YAML properties and relocate doc…#8701KamilPatora wants to merge 5 commits into
KamilPatora wants to merge 5 commits into
Conversation
…ument end comments after merges
…ument end comments after merges
…ument end comments after merges
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What's changed?
-Preserve inline comments stored in Yaml.Document.End.prefix when ChangePropertyKey moves another property after their original owner.
-Add a focused, package-private YamlDocumentEndCommentRelocator.
-Relocate a comment only when:its original owner still exists,it gains an immediate successor,and the same comment is still present in the document-end prefix.
-Preserve CRLF line endings, standalone comments, and YAML document separators.
-Add regression coverage for deeply nested properties, moved final properties, multi-document YAML, CRLF, and standalone comments.
What's your motivation?
When ChangePropertyKey moved a non-final property, an inline comment belonging to an unchanged final property remained in the document-end prefix. After the moved property was inserted, the comment was rendered as though it belonged to that property.
The fix tracks the original final entry by its ID and moves the comment to the prefix of its new immediate successor. If the original owner no longer exists or remains the final entry, the document-end comment is left unchanged.
spring:
data:
mongodb:
uri: "test"
servlet:
multipart:
max-request-size: 162529280 #155MB
spring:
servlet:
multipart:
max-request-size: 162529280
mongodb:
uri: "test" #155MB
Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
Have you considered any alternatives or workarounds?
Any additional context
Checklist
./gradlew buildlocally, and committed any resulting changes torecipes.csv