-
Notifications
You must be signed in to change notification settings - Fork 356
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
When merging yaml files comments on the last element of existing block are placed at the wrong line #4671
When merging yaml files comments on the last element of existing block are placed at the wrong line #4671
Conversation
65f8e16
to
bd350d8
Compare
rewrite-yaml/src/main/java/org/openrewrite/yaml/MergeYamlVisitor.java
Outdated
Show resolved
Hide resolved
new MergeYamlVisitor<>(document.getBlock(), yaml, Boolean.TRUE.equals(acceptTheirs), objectIdentifyingProperty) | ||
.visitNonNull(document.getBlock(), ctx, getCursor()) | ||
); | ||
return getCursor().getMessage(REMOVE_PREFIX, false) ? d.withEnd(d.getEnd().withPrefix("")) : d; |
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.
I actually don't like very much that I needed to put this here; I would rather keep the cursor messages locked in the MergeYamlVisitor
class. I couldn't make it work though, because the visitDocument
will not be called in that class.
If I overlooked something please let me know! It would be really nice to let this MergeYaml visitor file untouched.
rewrite-yaml/src/main/java/org/openrewrite/yaml/MergeYamlVisitor.java
Outdated
Show resolved
Hide resolved
0f7e1b0
to
35948c7
Compare
…or.java Co-authored-by: Jacob van Lingen <[email protected]>
…count' of github.com:openrewrite/rewrite into 2218-mergeyamlvisitor-inline-comments-not-taken-into-account # Conflicts: # rewrite-yaml/src/main/java/org/openrewrite/yaml/MergeYamlVisitor.java
…nt being refactored.
What's changed?
After merge of two yam files, the comments will be placed at the right position.
What's your motivation?
Checklist