Skip to content

Conversation

@jonringer
Copy link
Contributor

Formatters help to avoid a lot of potential merge conflicts and review churn.

@jonringer jonringer changed the title Formatter for Ekapkgs [0027] Formatter for Ekapkgs May 26, 2025
@nrdxp
Copy link
Member

nrdxp commented May 26, 2025

solid assessment, as a personal user of alexandra can't really argue

@tgunnoe
Copy link

tgunnoe commented May 28, 2025

agree as well, I miss that container space

- Not actively maintained
- Not predictable formatting
- It's more "convergent", rather than deterministic
- Sometimes requires the tool to be ran many times to converge to final state
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I've never had to do this.

Also, one "pro" of nixpkgs-fmt is that it doesn't break arguments into multiple lines like alejandra does!

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neither have I. But I would also write pretty close to what nixpgks-fmt would output

@nrdxp
Copy link
Member

nrdxp commented Jun 16, 2025

TIL I learned alejandra added experimental configuration options. Perhaps instead of forking, upstream would accept a patch to optionally re-enable container space?

@sshine
Copy link

sshine commented Jul 7, 2025

One downside of alejandra is that its IDE support does not progressively parse errors, so if an error occurs, it exits with an error code and a small error pop-up occurs in VSCode. I might be mixing up formatting and LSP/linting, but as a total experience, there's room for improvement.

Still, the output is nice and the codebase is healthy. I like it.

@sshine
Copy link

sshine commented Aug 3, 2025

Two things mentioned on Discord are:

  • If alejandra allows for options to tweak its long argument list behavior (it seems to only support indentation = "TwoSpaces | FourSpaces | Tabs" on main), that might count up; Then its main downside is that its IDE integration is sub-par compared to e.g. Rust's which just silently exits on invalid syntax.
  • nixpkgs-fmt might work even though it's not actively developed. Then its main downside seems to be its convergence towards correct formatting.

If active maintenance is a lower factor, forking one and applying moderate changes might also be an option.

@jonringer
Copy link
Contributor Author

I would like to investigate nixpkgs-fmt, I'm fine with not everything being super deterministic. I just want readibility.

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

Successfully merging this pull request may close these issues.

5 participants