-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
some lines not wrapped to specified width #255
Comments
Let's set aside for now that the line length option in its current form has drifted pretty far away from its original semantic intention — You sound like you'd want a fairly hard line limit and code to never exceed that. If so, how would you want Nixfmt to deal with lines which inherently exceed that limit, like long comments and strings? Unlike in many other programming languages, this tends to happen pretty often in common Nix code, mostly due to hashes and source URLs. |
In #256 I reintroduce the line break after the |
Yeah. Oof, TIL Nix can't escape newlines in strings: $ cat wat.nix
"lol \
lmao"
$ nix eval --file wat.nix --raw | od -t x1
0000000 6c 6f 6c 20 0a 6c 6d 61 6f
0000011 In other languages this would result in:
Generally I find that (nightly) rustfmt does what I want:
I think probably the worst part is that automatically reflowing text in Nix code isn't straightforward because a lot of it is inline Bash. Even if the code still does the same thing it probably causes rebuilds since the literal text would be different. In this case I would probably expect |
This partially addresses NixOS#255
This partially addresses NixOS#255
Uh you not gonna like this, but Nix does have escaping rules, otherwise in your example the |
lmao |
Description
I want to use
--width 80
but it seems to not actually matter what value I pass, in the below example, the output is always the input.Small example input
Expected output
Should be formatted to wrap at 80 columns. I don't particularly care what exactly that would look like.
Actual output
The input is unmodified.
The text was updated successfully, but these errors were encountered: