Subject: Re: bug#60696: 30.0.50; tree-sitter: node representation breaks `pp-buffer'
From: Yuan Fu <[email-masked]>
To: Mickey Petersen <[email-masked]>
Cc: [email-masked]
Date: Mon, 9 Jan 2023 20:18:55 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Mickey Petersen <[email-masked]> writes:

> Nodes appear pretty-printed like this:
>
>      #<treesit-node 
>        (block)
>        in 159-173>
>
> Because `pp-buffer' uses `downward-list' and `upward-list' to
> determine list boundaries and where to line break.
>
> The solution is to perhaps consider using a different notation than
> `(block)' in the printed representation of the object. (Or make
> `pp-buffer' much smarter, but that is perhaps far more work.)

I see, and I guess using parenthesizes inside an object could break other things.
Although I like the correspondence between query syntax and printed node
type [1], it’s probably better not print parenthesizes inside an object.
Now that node is printed as #<treesit-node block in 159-173>

[1] (block) -> #<treesit-node (block) in ...>
    ";"     -> #<treesit-node ";" in ...>

Yuan