# zig fmt: fix formatting for single-line containers with comments · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/a130eac7857512db50320fb1c64079b0d696885d)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: a130eac7857512db50320fb1c64079b0d696885d

Requested commit: a130eac7857512db50320fb1c64079b0d696885d

Commit: a130eac7857512db50320fb1c64079b0d696885d

Tree: f886cd204f4e5d6657161f3d8f26cbfd18e1c4ca

Author: tjohnes

Committer: Andrew Kelley

## Message

```
zig fmt: fix formatting for single-line containers with comments

* Fixes #8810.
* Prevent a single-line container declaration if it contains a comment
  or multiline string.
* If a container declaration cannot be single-line, ensure container
  fields are rendered with a trailing comma.
* If `Space.comma` is passed to `renderExpressionComma` or
  `renderTokenComma`, and there already exists a comma in the source,
  then render one comma instead of two.

```

## Parents

- [36c8adf58922d8e357bbaf7ce914cfd4b7b56354](https://git.cafe/gitcafe/zig/commit/36c8adf58922d8e357bbaf7ce914cfd4b7b56354?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/a130eac7857512db50320fb1c64079b0d696885d?format=markdown)
