-
Notifications
You must be signed in to change notification settings - Fork 119
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
Format parameters better #3731
Format parameters better #3731
Conversation
6ef7589
to
c91cf90
Compare
if (trailingComma) suffix += ', '; | ||
} else { | ||
suffix += ', '; | ||
for (var p in namedParams) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make a helper to avoid the duplicate logic of each parameter type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I was able to fold more things into _renderParameter
, much simpler. Thanks!
</span> | ||
\} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the opening bracket for all the closing brackets in these tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch; these all moved to where you'd expect, based on where the closing ones moved. Updated the tests.
In a nutshell: * When there are more than 3 parameters, or any named parameters, use "block style" (vs "inline style", using CSS terminology). * In block style, always place a comma after the last parameter. * In block style, display a `{` or `[` delimiter between required and optional parameters, to the right of the last required parameter. * In block style, display a `}` or `]` closing delimiter on the line after the last optional parameter, just before the closing `)`. * Do not change inline style. * Indent soft-wrapped lines. This is not as good as whatever `dart format` would do when hard-wrapping lines, but at least a wrapped parameter has it's non-first-line text indented to separate from the surrounding parameter indentations.
c91cf90
to
53b497f
Compare
Revisions updated by `dart tools/rev_sdk_deps.dart`. dartdoc (https://github.com/dart-lang/dartdoc/compare/79c1675..bf6080c): bf6080c8 2024-03-27 Sam Rawlins Remove unnecessary EnclosedElement mixin (dart-lang/dartdoc#3736) c5bb9066 2024-03-26 Sam Rawlins Bump to 8.0.8; fix changelog wrapping (dart-lang/dartdoc#3735) 4e096f84 2024-03-26 Sam Rawlins Format parameters better (dart-lang/dartdoc#3731) http (https://github.com/dart-lang/http/compare/7949d6f..280d361): 280d361 2024-03-27 Derek Xu [package:http_profile] Expand README.md (dart-lang/http#1162) 9fddb1c 2024-03-27 Brian Quinlan Fix the connectionInfo getter (dart-lang/http#1163) 9f47439 2024-03-27 Derek Xu [package:http_profile] Make connectionInfo a top-level field of HttpClientRequestProfile (dart-lang/http#1160) Change-Id: Ib50584ef7d7914ab262bb01eeb087e44c34e4dc7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360240 Auto-Submit: Devon Carew <devoncarew@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Compare:
test()
andorElse()
now on one lineContribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.