| Index: pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
|
| index 02f7ed0b1330abb00ff970c545ba34fc5ffc139a..07ee0742f50419a6274c451dd74e48371f73a704 100644
|
| --- a/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
|
| +++ b/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
|
| @@ -294,7 +294,7 @@ class InterfaceTypeSuggestionBuilder {
|
| * Add a suggestion based upon the given element, provided that it is not
|
| * shadowed by a previously added suggestion.
|
| */
|
| - void addSuggestion(Element element) {
|
| + void addSuggestion(Element element, {int relevance: DART_RELEVANCE_DEFAULT}) {
|
| if (element.isPrivate) {
|
| LibraryElement elementLibrary = element.library;
|
| LibraryElement unitLibrary = request.unit.element.library;
|
| @@ -339,14 +339,15 @@ class InterfaceTypeSuggestionBuilder {
|
| assert(false);
|
| return;
|
| }
|
| - CompletionSuggestion suggestion = createSuggestion(element, kind: kind);
|
| + CompletionSuggestion suggestion =
|
| + createSuggestion(element, kind: kind, relevance: relevance);
|
| if (suggestion != null) {
|
| request.addSuggestion(suggestion);
|
| }
|
| }
|
|
|
| - void _buildSuggestions(
|
| - InterfaceType type, LibraryElement library, bool isSuper) {
|
| + void _buildSuggestions(InterfaceType type, LibraryElement library,
|
| + bool isSuper, String containingMethodName) {
|
| if (isSuper) {
|
| // Suggest members from superclass if the target is "super"
|
| type = type.superclass;
|
| @@ -358,11 +359,15 @@ class InterfaceTypeSuggestionBuilder {
|
| // completions. If multiple elements are found that complete to the same
|
| // identifier, addSuggestion will discard all but the first (with a few
|
| // exceptions to handle getter/setter pairs).
|
| - for (InterfaceType targetType in _getTypeOrdering(type)) {
|
| + List<InterfaceType> types = _getTypeOrdering(type);
|
| + for (InterfaceType targetType in types) {
|
| for (MethodElement method in targetType.methods) {
|
| // Exclude static methods when completion on an instance
|
| if (!method.isStatic) {
|
| - addSuggestion(method);
|
| + addSuggestion(method,
|
| + relevance: method.name == containingMethodName
|
| + ? DART_RELEVANCE_HIGH
|
| + : DART_RELEVANCE_DEFAULT);
|
| }
|
| }
|
| for (PropertyAccessorElement propertyAccessor in targetType.accessors) {
|
| @@ -421,7 +426,7 @@ class InterfaceTypeSuggestionBuilder {
|
| * Add suggestions for the visible members in the given interface
|
| */
|
| static void suggestionsFor(DartCompletionRequest request, DartType type,
|
| - {bool isSuper: false}) {
|
| + {bool isSuper: false, String containingMethodName: null}) {
|
| CompilationUnit compilationUnit =
|
| request.target.containingNode.getAncestor((n) => n is CompilationUnit);
|
| LibraryElement library = compilationUnit.element.library;
|
| @@ -430,7 +435,7 @@ class InterfaceTypeSuggestionBuilder {
|
| }
|
| if (type is InterfaceType) {
|
| return new InterfaceTypeSuggestionBuilder(request)._buildSuggestions(
|
| - type, library, isSuper);
|
| + type, library, isSuper, containingMethodName);
|
| }
|
| }
|
| }
|
|
|