[analysis_server] Fix blank-line placement in sort_constructors_first fix - #64041
[analysis_server] Fix blank-line placement in sort_constructors_first fix#64041hkarmoush wants to merge 2 commits into
Conversation
… fix The quick-fix moved a constructor's leading gap (any blank line separating it from its previous sibling) verbatim to the insertion point. That turned a blank line that used to separate the constructor from the *previous* member into a stray leading blank line at the top of the body, while leaving no separator between the relocated constructor and the member that now follows it. The constructor now always starts on its own line at the insertion point with no leading blank line. If a blank line used to separate it from its previous member, that separation is preserved by moving it after the constructor instead, unless the insertion point already has its own blank line there naturally, to avoid doubling up. Fixes dart-lang#60703
|
Thank you for your contribution! This project uses Gerrit for code reviews. Your pull request has automatically been converted into a code review at: https://dart-review.googlesource.com/c/sdk/+/536000 Please wait for a developer to review your code review at the above link; you can speed up the review if you sign into Gerrit and manually add a reviewer that has recently worked on the relevant code. See CONTRIBUTING.md to learn how to upload changes to Gerrit directly. Additional commits pushed to this PR will update both the PR and the corresponding Gerrit CL. After the review is complete on the CL, your reviewer will merge the CL (automatically closing this PR). |
|
https://dart-review.googlesource.com/c/sdk/+/536000 has been updated with the latest commits from this pull request. |
…ed constructor Address review feedback on the previous commit: when a constructor is moved to sit right after an enum's constant list, and the file already separates members with blank lines (evidenced by a blank line having separated the constructor from its own previous member), also add a blank line between the constant list and the relocated constructor, so that boundary isn't left inconsistent with the rest of the file's style. A class body has no analogous boundary: its insertion point is the opening brace, where a leading blank line is never wanted.
|
https://dart-review.googlesource.com/c/sdk/+/536000 has been updated with the latest commits from this pull request. |
1 similar comment
|
https://dart-review.googlesource.com/c/sdk/+/536000 has been updated with the latest commits from this pull request. |
|
CL has new comments, please view and respond to them in Gerrit. If a reviewer requested changes, push new commits to this PR and it will be automatically copied to Gerrit. After that you can mark reviewer comments as resolved in Gerrit and request another round of reviews. Note: when you add comments in Gerrit they only become visible after you send them by clicking Reply and Send. |
Summary
sort_constructors_firstquick-fix moved a constructor's leading whitespace gap (including any blank line separating it from its previous sibling) verbatim to the insertion point, producing a stray leading blank line at the top of the body and no separator between the relocated constructor and the member that now follows it.Fixes #60703
Test plan
test_noBlankLineAfterOpeningBrace,test_enum_noBlankLineAfterSemicolon, andtest_enum_blankLineMovesFromOldGapToAfterConstructortosort_constructor_first_test.dart, covering the class and enum scenarios from the issue.SortConstructorFirstBulkTest.test_single_class's expected output to match the corrected, consistent spacing behavior.dart test test/src/services/correction/fix/sort_constructor_first_test.dart— all 17 tests pass.pkg/analysis_server/test/src/services/correction/fix/— all 4765 tests pass, no regressions.dart format/dart analyzeclean on changed files.