-
-
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
Escape sequences not handled properly #189
Comments
These strings are semantically equivalent in Nix:
Not sure if nixfmt should preserve the input regardless or not. On the one hand I want it to treat strings as opaque and never change them, on the other hand normalizing this here has the potential of uncovering very subtle bugs. |
I don't even remember why I have that key specific string in the key binding but it looks like Nix is actually writing the "incorrect" string to the target file. Contents of
And it works. So not an issue at all. Sorry for the trouble :) |
I think we should preserve the input regardless, because it's not nixfmt's job to fix these kind of problems. Instead it should be Nix itself that does that. And we do have that in the standard:
And by preserving this we can also simplify the code because we don't need to think as much about how Nix parses strings. If you don't mind, let's leave this open for now :) |
We very briefly discussed this in todays team meeting:
|
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 |
Description
It appears that
nixfmt
does not preserve backslashes. I have the following two lines in mydarwin.nix
:https://github.com/thefossguy/prathams-nixos/blob/6acda3f9c27516b81a29d718ea1cb3b1025f86b6/nixos-configuration/home-manager/darwin.nix#L56-L57
And this got mangled like so:
The text was updated successfully, but these errors were encountered: