-
Notifications
You must be signed in to change notification settings - Fork 125
dart_style implementation for named arguments anywhere #1072
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
Labels
Comments
23 tasks
munificent
added a commit
that referenced
this issue
Feb 17, 2022
I opted to add support for this while being minimally invasive to the existing style and formatting. All existing code which does not have any positional arguments after named ones retains its previous formatting. For new argument lists that use positional arguments after named ones, I try to mostly follow the existing style rules even though they can be fairly complex. In particular, it will be pretty aggressive about applying block-style formatting to function literals inside argument lists even with named args anywhere. I think that's important to support the main use case I know of for the feature which is trailing positional closures like: function(named: 1, another: 2, () { block... }); In argument lists using named args anywhere that don't have block functions, it treats all arguments like named ones. That provides nice simple formatting like: function( argument1, named: argument2, argument3, another: argument4); I think that does a good job of highlighting which arguments are named, which is what we want. Fix #1072.
munificent
added a commit
that referenced
this issue
Feb 23, 2022
* Formatting support for named arguments anywhere. I opted to add support for this while being minimally invasive to the existing style and formatting. All existing code which does not have any positional arguments after named ones retains its previous formatting. For new argument lists that use positional arguments after named ones, I try to mostly follow the existing style rules even though they can be fairly complex. In particular, it will be pretty aggressive about applying block-style formatting to function literals inside argument lists even with named args anywhere. I think that's important to support the main use case I know of for the feature which is trailing positional closures like: function(named: 1, another: 2, () { block... }); In argument lists using named args anywhere that don't have block functions, it treats all arguments like named ones. That provides nice simple formatting like: function( argument1, named: argument2, argument3, another: argument4); I think that does a good job of highlighting which arguments are named, which is what we want. Fix #1072. * Rewrite doc comments.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The "named arguments anywhere" language change allows named arguments to come before positional ones. Today, the argument list formatter assumes all named arguments will appear at the end of the argument list. Fixing this—and even figuring out how these mixed arguments lists should be formatted—might be pretty hard.
The text was updated successfully, but these errors were encountered: