nixpkgs-fmt
nixpkgs-fmt copied to clipboard
"#dontformat" directive
Is your feature request related to a problem? Please describe. Some blocks of code are just better formatted by humans:
colors = [
"3A3C43" "BE3E48" "869A3A" "C4A535" "4E76A1" "855B8D" "568EA3" "B8BCB9"
"888987" "FB001E" "0E712E" "C37033" "176CE3" "FB0067" "2D6F6C" "FCFFB8"
];
turns into
colors = [
"3A3C43"
"BE3E48"
...
"2D6F6C"
"FCFFB8"
];
Describe the solution you'd like #dontformat directives, turning off formatting for a given code block:
colors = [
#dontformat
"3A3C43" "BE3E48" "869A3A" "C4A535" "4E76A1" "855B8D" "568EA3" "B8BCB9"
"888987" "FB001E" "0E712E" "C37033" "176CE3" "FB0067" "2D6F6C" "FCFFB8"
#/dontformat
];
Describe alternatives you've considered
- Per-block formatting, which would ignore formatting in tree and it's descendants
{ something = [ #dontfornat "3A3C43" "BE3E48" "869A3A" "C4A535" "4E76A1" "855B8D" ]; thiswillbeformatted = { a = 12; b = 5; }; }
- Just giving up hope and accepting blackness of this formatter.
I'd prefer what you call "per-block formatting", because I think writing end sequences for the directive is more tedious than it helps.
Potentially it could also target a specific rule if we give them proper names.
{
# nixpkgs-fmt skip=list-formatting
something = [
"3A3C43" "BE3E48" "869A3A" "C4A535"
"4E76A1" "855B8D"
];
}
This is the only thing I've found missing from this tool. It's nice to be able to control whitespace indentation sometimes
Potentially it could also target a specific rule if we give them proper names.
This feels like the right way to do and aligns with other linter tools.