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

Reaching a stable list formatting requires formatting twice #188

Closed
TomaSajt opened this issue Apr 6, 2024 · 3 comments · Fixed by #201
Closed

Reaching a stable list formatting requires formatting twice #188

TomaSajt opened this issue Apr 6, 2024 · 3 comments · Fixed by #201
Assignees
Labels
bug Something isn't working idempotency Output changes on second formatting

Comments

@TomaSajt
Copy link

TomaSajt commented Apr 6, 2024

Description

Just a small thing I noticed while packaging stuff for Nixpkgs.

Small example input

[ "hello"

]

Expected output

[ "hello" ]

Actual output

after first formatting

[
  "hello"
]

then after formatting again, it gives the correct

[ "hello" ]
@TomaSajt TomaSajt moved this to (unused) in Nix formatting Apr 6, 2024
@TomaSajt TomaSajt removed the status in Nix formatting Apr 6, 2024
@piegamesde piegamesde self-assigned this Apr 9, 2024
@piegamesde piegamesde added bug Something isn't working idempotency Output changes on second formatting labels Apr 9, 2024
piegamesde added a commit to piegamesde/nixfmt that referenced this issue Apr 16, 2024
@piegamesde piegamesde mentioned this issue Apr 16, 2024
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/formatting-team-meeting-2024-04-16/43533/1

piegamesde added a commit to piegamesde/nixfmt that referenced this issue May 8, 2024
infinisil pushed a commit to piegamesde/nixfmt that referenced this issue May 14, 2024
@infinisil
Copy link
Member

Looking into this, I'm thinking the following:

[ "string"

]

should be formatted like this:

[
  "string"

]

Because "empty lines must be preserved".

I've now implemented this in #201

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/formatting-team-meeting-2024-05-28/46126/1

@infinisil infinisil moved this from Todo to Done in Nix formatting May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working idempotency Output changes on second formatting
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants