File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
lib/src/services/correction
test/src/services/correction/assist Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -3749,6 +3749,12 @@ class AssistProcessor {
3749
3749
selectedStatements.add (selectedNode);
3750
3750
}
3751
3751
}
3752
+ // we want only statements in blocks
3753
+ for (var statement in selectedStatements) {
3754
+ if (statement.parent is ! Block ) {
3755
+ return ;
3756
+ }
3757
+ }
3752
3758
// we want only statements
3753
3759
if (selectedStatements.isEmpty ||
3754
3760
selectedStatements.length != selectedNodes.length) {
Original file line number Diff line number Diff line change @@ -19,6 +19,18 @@ class SurroundWithBlockTest extends AssistProcessorTest {
19
19
@override
20
20
AssistKind get kind => DartAssistKind .SURROUND_WITH_BLOCK ;
21
21
22
+ test_notStatementInBlock () async {
23
+ await resolveTestUnit ('''
24
+ main() {
25
+ while (true)
26
+ // start
27
+ print(0);
28
+ // end
29
+ }
30
+ ''' );
31
+ await assertNoAssist ();
32
+ }
33
+
22
34
test_twoStatements () async {
23
35
await resolveTestUnit ('''
24
36
main() {
You can’t perform that action at this time.
0 commit comments