Index: pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart |
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart |
index 9553dbaf7aa04f7a9664d529aa5d8e56cf5de4ab..8065c15083f902f5769cc59421733e583d86dc95 100644 |
--- a/pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart |
+++ b/pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart |
@@ -62,37 +62,54 @@ class InheritedReferenceContributor extends DartCompletionContributor |
if (!request.includeIdentifiers) { |
return EMPTY_LIST; |
} |
+ |
ClassDeclaration classDecl = _enclosingClass(request.target); |
if (classDecl == null || classDecl.element == null) { |
return EMPTY_LIST; |
} |
- |
containingLibrary = request.libraryElement; |
+ return _computeSuggestionsForClass2(resolutionMap |
+ .elementDeclaredByClassDeclaration(classDecl), request); |
+ } |
+ |
+ List<CompletionSuggestion> _computeSuggestionsForClass2( |
+ ClassElement classElement, DartCompletionRequest request, |
+ {bool skipChildClass: true}) { |
bool isFunctionalArgument = request.target.isFunctionalArgument(); |
kind = isFunctionalArgument |
? CompletionSuggestionKind.IDENTIFIER |
: CompletionSuggestionKind.INVOCATION; |
- OpType optype = (request as DartCompletionRequestImpl).opType; |
- for (InterfaceType type in resolutionMap |
- .elementDeclaredByClassDeclaration(classDecl) |
- .allSupertypes) { |
- if (!isFunctionalArgument) { |
- for (PropertyAccessorElement elem in type.accessors) { |
- if (elem.isGetter) { |
- if (optype.includeReturnValueSuggestions) { |
- addSuggestion(elem); |
- } |
- } else { |
- if (optype.includeVoidReturnSuggestions) { |
- addSuggestion(elem); |
- } |
- } |
- } |
- } |
- for (MethodElement elem in type.methods) { |
- if (elem.returnType == null) { |
- addSuggestion(elem); |
- } else if (!elem.returnType.isVoid) { |
+ OpType optype = request.opType; |
+ |
+ if (!skipChildClass) { |
+ _addSuggestionsForType(classElement.type, optype, |
+ isFunctionalArgument: isFunctionalArgument); |
+ } |
+ |
+ for (InterfaceType type in classElement.allSupertypes) { |
+ _addSuggestionsForType(type, optype, |
+ isFunctionalArgument: isFunctionalArgument); |
+ } |
+ return suggestions; |
+ } |
+ |
+ List<CompletionSuggestion> computeSuggestionsForClass( |
+ ClassElement classElement, DartCompletionRequest request, |
+ {bool skipChildClass: true}) { |
+ if (!request.includeIdentifiers) { |
+ return EMPTY_LIST; |
+ } |
+ containingLibrary = request.libraryElement; |
+ |
+ return _computeSuggestionsForClass2(classElement, request, |
+ skipChildClass: skipChildClass); |
+ } |
+ |
+ _addSuggestionsForType(InterfaceType type, OpType optype, |
+ {bool isFunctionalArgument: false}) { |
+ if (!isFunctionalArgument) { |
+ for (PropertyAccessorElement elem in type.accessors) { |
+ if (elem.isGetter) { |
if (optype.includeReturnValueSuggestions) { |
addSuggestion(elem); |
} |
@@ -103,6 +120,18 @@ class InheritedReferenceContributor extends DartCompletionContributor |
} |
} |
} |
- return suggestions; |
+ for (MethodElement elem in type.methods) { |
+ if (elem.returnType == null) { |
+ addSuggestion(elem); |
+ } else if (!elem.returnType.isVoid) { |
+ if (optype.includeReturnValueSuggestions) { |
+ addSuggestion(elem); |
+ } |
+ } else { |
+ if (optype.includeVoidReturnSuggestions) { |
+ addSuggestion(elem); |
+ } |
+ } |
+ } |
} |
} |