Created
June 29, 2021 20:32
-
-
Save d10xa/aa1654411bfd0b34b4958b5e1b8253db to your computer and use it in GitHub Desktop.
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
val pprint2 = | |
pprint.copy( | |
additionalHandlers = { | |
case value: java.nio.file.Path => | |
val v = pprint.Util.literalize(value.toString) | |
pprint.Tree.Apply( | |
"Paths.get", | |
Iterator(v).map(pprint.Tree.Literal.apply) | |
) | |
case value: scala.meta.inputs.Position.Range => | |
val inputPart = pprint.Util.literalize(value.input.text) | |
val input = pprint.Tree.Apply( | |
"Input.String", | |
Iterator(inputPart).map(pprint.Tree.Literal.apply) | |
) | |
val start = pprint.Tree.Literal.apply(value.start.toString) | |
val end = pprint.Tree.Literal.apply(value.end.toString) | |
pprint.Tree | |
.Apply( | |
"scala.meta.inputs.Position.Range", | |
Iterator(input, start, end) | |
) | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment