Skip to content
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

Product with multi-line prefix will break display. #40

Open
tribbloid opened this issue Jul 30, 2020 · 0 comments
Open

Product with multi-line prefix will break display. #40

tribbloid opened this issue Jul 30, 2020 · 0 comments

Comments

@tribbloid
Copy link

Here is a simple example.


  val nodeStr = s"""
                   |[A]
                   |[B]
                   |""".stripMargin.trim

  case class Prod(prefix: String)(vs: Any*) extends Product {
    override def productPrefix: String = prefix

    override def productArity: Int = vs.size

    override def productElement(n: Int): Any = vs(n)
  }

  it("try it another time") {

    val v = Prod(nodeStr)(
      Prod(nodeStr)(
        Prod(nodeStr)(),
        Prod(nodeStr)()
      )
    )

    pprint.pprintln(v)
  }

Output:

[A]
[B](
  [A]
[B](
    [A]
[B](),
    [A]
[B]()
  )
)

Most indentations of [B] are wrong.

Also, I wonder if I can submit a quick patch to customise parenthesis, indentation characters, and comma space? Combining with a fix of the above issue, it will be capable of pprint arbitrary trees (e.g. a Spark SQL LogicalPlan)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant