diff --git a/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart b/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart index f82c19cb60d..e9a48d3d5ee 100644 --- a/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart +++ b/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart @@ -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; } } diff --git a/pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart b/pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart index 7907820e102..1558593778a 100644 --- a/pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart +++ b/pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart @@ -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',