| Index: pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart b/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
|
| index 5e6de53ab2d71c24186df15e9e5c7e76aab06215..adc4b603084c9a4a3f9d5b6a63ec90170fbd3576 100644
|
| --- a/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
|
| +++ b/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
|
| @@ -106,6 +106,14 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
|
| return;
|
| }
|
| }
|
| + if (previousMember is ImportDirective) {
|
| + if (previousMember.semicolon == null || previousMember.semicolon.isSynthetic) {
|
| + // If the prior member is an unfinished import directive
|
| + // then the user is probably finishing that
|
| + _addImportDirectiveKeywords(previousMember);
|
| + return;
|
| + }
|
| + }
|
| if (previousMember == null || previousMember is Directive) {
|
| if (previousMember == null &&
|
| !node.directives.any((d) => d is LibraryDirective)) {
|
| @@ -128,6 +136,27 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
|
| }
|
| }
|
|
|
| + @override
|
| + visitImportDirective(ImportDirective node) {
|
| + if (entity == node.asKeyword) {
|
| + if (node.deferredKeyword == null) {
|
| + _addSuggestion(Keyword.DEFERRED, DART_RELEVANCE_HIGH);
|
| + }
|
| + }
|
| + if (entity == node.semicolon) {
|
| + _addImportDirectiveKeywords(node);
|
| + }
|
| + }
|
| +
|
| + void _addImportDirectiveKeywords(ImportDirective node) {
|
| + if (node.asKeyword == null) {
|
| + _addSuggestion(Keyword.AS, DART_RELEVANCE_HIGH);
|
| + if (node.deferredKeyword == null) {
|
| + _addSuggestion(Keyword.DEFERRED, DART_RELEVANCE_HIGH);
|
| + }
|
| + }
|
| + }
|
| +
|
| void _addClassDeclarationKeywords(ClassDeclaration node) {
|
| // Very simplistic suggestion because analyzer will warn if
|
| // the extends / with / implements keywords are out of order
|
|
|