You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
nixfmt currently uses heuristics to find sensible places to insert line breaks, once a line becomes too long.
In the case of multi-arg function calls this can be counter productive, and result in less-readable code than if a more simplistic "one arg per line" approach is taken.
Small example input
{config_file_path=defaultNullOpts.mkNullable(withtypes;eitherstr(listOfstr))[]"Custom config file path or list of custom config file paths.";}
Expected output
{config_file_path=defaultNullOpts.mkNullable(withtypes;eitherstr(listOfstr))[]"Custom config file path or list of custom config file paths.";}
Actual output
{config_file_path=defaultNullOpts.mkNullable(withtypes;eitherstr(listOfstr))[]"Custom config file path or list of custom config file paths.";}
Note: there is also some strange line-breaking done within the empty list here. That is #268.
config_file_path=defaultNullOpts.mkNullable(withtypes;eitherstr(listOfstr))[]"Some example long text that causes the line to be too long.";
The desired style already exists, the current behavior was introduced because it was deemed an improvement in many cases. In fact, if you make the string longer or add more arguments until the trailing code hits the line limit, it will switch style again and put the string onto a new line.
The desired style already exists, the current behavior was introduced because it was deemed an improvement in many cases.
In that case, is this issue a "won't fix"? i.e. the formatting is already as intended
In fact, if you make the string longer or add more arguments until the trailing code hits the line limit, it will switch style again and put the string onto a new line.
Interesting. I'll play around with that if I get chance.
Description
nixfmt currently uses heuristics to find sensible places to insert line breaks, once a line becomes too long.
In the case of multi-arg function calls this can be counter productive, and result in less-readable code than if a more simplistic "one arg per line" approach is taken.
Small example input
Expected output
Actual output
Note: there is also some strange line-breaking done within the empty list here. That is #268.
This was originally discussed here nix-community/nixvim#2209 (comment)
The text was updated successfully, but these errors were encountered: