Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart

Issue 2771653002: Completion boilerplate for Flutter cons children (flutter-intellij#463) (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
index 1921bfaa626d0f5b9bd06e8d8cdc0d6f6b765838..e58bbc7b09220f9d49da90e1f92e07ed984dd2ad 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
@@ -7,6 +7,7 @@ library services.completion.contributor.dart.type_member;
import 'dart:async';
import 'dart:collection';
+import 'package:analysis_server/src/ide_options.dart';
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
import 'package:analysis_server/src/services/completion/dart/local_declaration_visitor.dart';
import 'package:analysis_server/src/services/completion/dart/suggestion_builder.dart';
@@ -106,7 +107,7 @@ class TypeMemberContributor extends DartCompletionContributor {
// Build the suggestions
if (type is InterfaceType) {
_SuggestionBuilder builder = new _SuggestionBuilder(containingLibrary);
- builder.buildSuggestions(type, containingMethodName);
+ builder.buildSuggestions(type, containingMethodName, request.ideOptions);
return builder.suggestions.toList();
}
return EMPTY_LIST;
@@ -285,7 +286,8 @@ class _SuggestionBuilder {
* If the 'dot' completion is a super expression, then [containingMethodName]
* is the name of the method in which the completion is requested.
*/
- void buildSuggestions(InterfaceType type, String containingMethodName) {
+ void buildSuggestions(
+ InterfaceType type, String containingMethodName, IdeOptions ideOptions) {
// Visit all of the types in the class hierarchy, collecting possible
// completions. If multiple elements are found that complete to the same
// identifier, addSuggestion will discard all but the first (with a few
@@ -297,7 +299,7 @@ class _SuggestionBuilder {
if (!method.isStatic) {
// Boost the relevance of a super expression
// calling a method of the same name as the containing method
- _addSuggestion(method,
+ _addSuggestion(method, ideOptions,
relevance: method.name == containingMethodName
? DART_RELEVANCE_HIGH
: DART_RELEVANCE_DEFAULT);
@@ -308,10 +310,10 @@ class _SuggestionBuilder {
if (propertyAccessor.isSynthetic) {
// Avoid visiting a field twice
if (propertyAccessor.isGetter) {
- _addSuggestion(propertyAccessor.variable);
+ _addSuggestion(propertyAccessor.variable, ideOptions);
}
} else {
- _addSuggestion(propertyAccessor);
+ _addSuggestion(propertyAccessor, ideOptions);
}
}
}
@@ -322,7 +324,7 @@ class _SuggestionBuilder {
* 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, IdeOptions options,
{int relevance: DART_RELEVANCE_DEFAULT}) {
if (element.isPrivate) {
if (element.library != containingLibrary) {
@@ -377,7 +379,7 @@ class _SuggestionBuilder {
return;
}
CompletionSuggestion suggestion =
- createSuggestion(element, relevance: relevance);
+ createSuggestion(element, options, relevance: relevance);
if (suggestion != null) {
_suggestionMap[suggestion.completion] = suggestion;
}

Powered by Google App Engine
This is Rietveld 408576698