Skip to content

Commit

Permalink
Update names and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pstreef committed Dec 19, 2024
1 parent 7fde385 commit 66dc881
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions rewrite-core/src/main/java/org/openrewrite/PrintOutputCapture.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,31 @@ public interface MarkerPrinter {
@Incubating(since = "8.41.4")
@RequiredArgsConstructor
enum MarkerMode {
/**
* Does not print any markers.
*/
NONE(MarkerPrinter.NONE),
/**
* Prints a squiggly line arrow in front of the marked element wrapped in a comment.
* /*~~>* /Thing thing
*/
DEFAULT(MarkerPrinter.DEFAULT),
/**
* Prints a squiggly line arrow in front of the marked element wrapped in a comment.
* Possibly adding verbose information, depending on the marker
* /*~~>(this is some verbose information)* /Thing thing
*/
VERBOSE(MarkerPrinter.VERBOSE),
FENCED(MarkerPrinter.FENCED),
SEARCH_ONLY(MarkerPrinter.SEARCH_ONLY);
/**
* Prints a squiggly arrow in front and after the marked element. It only includes {@link SearchResult}
* /*~~>* /Thing thing /**~~>* /
*/
SEARCH_ONLY(MarkerPrinter.SEARCH_ONLY),
/**
* Prints a fenced marker ID in front and after the marked element. It only includes {@link Markup} and {@link SearchResult}
* /*{{3e2a36bb-7c16-4b03-bdde-bffda08838e7}}* /Thing thing /*{{3e2a36bb-7c16-4b03-bdde-bffda08838e7}}* /
*/
FENCED_MARKUP_AND_SEARCH(MarkerPrinter.FENCED_MARKUP_AND_SEARCH);
@Getter
private final MarkerPrinter printer;
}
Expand All @@ -101,7 +121,7 @@ public String beforeSyntax(Marker marker, Cursor cursor, UnaryOperator<String> c
}
};

MarkerPrinter FENCED = new MarkerPrinter() {
MarkerPrinter FENCED_MARKUP_AND_SEARCH = new MarkerPrinter() {
@Override
public String beforeSyntax(Marker marker, Cursor cursor, UnaryOperator<String> commentWrapper) {
return marker instanceof SearchResult || marker instanceof Markup ? "{{" + marker.getId() + "}}" : "";
Expand Down

0 comments on commit 66dc881

Please sign in to comment.