Stream: ideas

Topic: AST snapshots parens


view this post on Zulip Anton (Apr 03 2025 at 14:41):

For the snapshot tests (e.g. src/snapshots/type_annotations.txt), this is the current format:

(file
    (module (1:1-1:10))
    (type_anno (3:1-4:4)
        "foo"
        (tag (3:7-3:10) "U64")))

Can we change this to:

(file
    (module (1:1-1:10))
    (type_anno (3:1-4:4)
        "foo"
        (tag (3:7-3:10) "U64")
    )
)

It can get pretty ridiculous otherwise:

(tag (7:14-7:20) "String")))))

It's also much easier to copy groups this way.

view this post on Zulip Luke Boswell (Apr 03 2025 at 22:41):

When do we add a newline?

I don't know how easy it is to change to formatting like this. Byt we isolated it to one place so should be possible.

view this post on Zulip Anton (Apr 04 2025 at 08:53):

When do we add a newline?

How about If the matching opening bracket is on an earlier line?

view this post on Zulip Brendan Hansknecht (Apr 04 2025 at 14:51):

Yeah, if the printout is multiline then it should do this


Last updated: Jun 16 2026 at 16:19 UTC