-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
MergeYaml
block indentation not as expected (#4358)
* fix: `MergeYaml` block indentation not as expected * Indication where things need to change * calculate indentation * add todo * Make it work with variable indent * Fix for sequences * cleanup * cleanup * comments * extract method * revert * revert * Merge yaml test for inline comments retention (#4365) * Added test cases to check inline comment retention. * Updated issue number to check inline comment retention. --------- Co-authored-by: j0m17kw <[email protected]> Co-authored-by: Peter Streef <[email protected]> * revert * Revert all to main (to start again) * Make multiline scalars work * Cleanup * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Add extra test `addPropertyWitCommentAboveLastLine` * Improve IndentsVisitor, so merged multiline scalars work too * Small improvements * Apply formatter * Consistently use the same style of import for nested classes * Reuse local variable `value` instead of repeated `incomingEntry.getValue()` * Small improvements --------- Co-authored-by: johnpaulms <[email protected]> Co-authored-by: j0m17kw <[email protected]> Co-authored-by: lingenj <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Tim te Beek <[email protected]>
- Loading branch information
1 parent
804abca
commit 615a767
Showing
8 changed files
with
390 additions
and
153 deletions.
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
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
32 changes: 32 additions & 0 deletions
32
rewrite-yaml/src/main/java/org/openrewrite/yaml/MultilineScalarChanged.java
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openrewrite.yaml; | ||
|
||
import lombok.Value; | ||
import lombok.With; | ||
import org.openrewrite.marker.Marker; | ||
|
||
import java.util.UUID; | ||
|
||
/** | ||
* Multiline scalars are added directly to the tree, which leads to a wrong ident level. | ||
*/ | ||
@Value | ||
@With | ||
public class MultilineScalarChanged implements Marker { | ||
UUID id; | ||
boolean added; | ||
} |
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.