Skip to content
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

Add option in zig fmt to set or customize max column length #15964

Closed
bauripalash opened this issue Jun 6, 2023 · 2 comments
Closed

Add option in zig fmt to set or customize max column length #15964

bauripalash opened this issue Jun 6, 2023 · 2 comments

Comments

@bauripalash
Copy link

Currently, there is no option (at least I couldn't find one) in zig fmt to customize the max column length; personally, I prefer 80, but zig fmt is doing its own thing.

I would like to propose a command line flag in zig fmt command to set max column width.

@nektro
Copy link
Contributor

nektro commented Jun 6, 2023

#1003 (comment) zig fmt so far has a policy of no options

commas can be used to explicitly delimit line breaks however,

var foo = [_]u8{ 0, 1, 2, 3, 4, 5, 6, };

will get subsequently transformed into:

var foo = [_]u8{
  0,
  1,
  2,
  3,
  4,
  5,
  6,
};

this works for array and struct initializers, function calls, function parameters, and more

specifically for arrays, grids are also possible. for instance the below is stable

var foo = [_]u8{
  0, 1, 2,
  3, 4, 5,
  6,
};

@bauripalash
Copy link
Author

Thanks for the clarification.

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

No branches or pull requests

2 participants