statement completion for expression bodies
See: https://github.com/flutter/flutter-intellij/issues/3253 Change-Id: Ib892833ecfa4500b726f4f6df42f16f0618c994d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118663 Reviewed-by: Steve Messick <messick@google.com> Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
2bd2392e2a
commit
7235115f36
@@ -207,8 +207,9 @@ class StatementCompletionProcessor {
|
||||
} else if (node is Declaration) {
|
||||
if (errors.isNotEmpty) {
|
||||
if (_complete_classDeclaration() ||
|
||||
_complete_functionDeclaration() ||
|
||||
_complete_variableDeclaration()) {
|
||||
_complete_variableDeclaration() ||
|
||||
_complete_simpleSemicolon() ||
|
||||
_complete_functionDeclaration()) {
|
||||
return completion;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1365,6 +1365,23 @@ main() {
|
||||
''');
|
||||
}
|
||||
|
||||
test_expressionBody() async {
|
||||
await _prepareCompletion(
|
||||
'=> 1',
|
||||
'''
|
||||
class Thing extends Object {
|
||||
int foo() => 1
|
||||
}
|
||||
''',
|
||||
atEnd: true);
|
||||
_assertHasChange('Add a semicolon and newline', '''
|
||||
class Thing extends Object {
|
||||
int foo() => 1;
|
||||
|
||||
}
|
||||
''');
|
||||
}
|
||||
|
||||
test_noCloseParen() async {
|
||||
await _prepareCompletion(
|
||||
'ing(3',
|
||||
|
||||
Reference in New Issue
Block a user