Skip to content

Instantly share code, notes, and snippets.

@d10xa
Created June 29, 2021 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d10xa/aa1654411bfd0b34b4958b5e1b8253db to your computer and use it in GitHub Desktop.
Save d10xa/aa1654411bfd0b34b4958b5e1b8253db to your computer and use it in GitHub Desktop.
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