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

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

Issue 684183002: Refactor CompletionSuggestionKind (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 2 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/imported_computer.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/imported_computer.dart b/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
index 2cfbc814ab775d626a24298662a7411ad2789884..12941090bfc8a668282ef24b90bbf9c35369d74f 100644
--- a/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
@@ -39,7 +39,7 @@ class ImportedComputer extends DartCompletionComputer {
}
/**
- * A visitor for determining which imported class and top level variable
+ * A visitor for determining which imported classes and top level variables
* should be suggested and building those suggestions.
*/
class _ImportedVisitor extends GeneralizingAstVisitor<Future<bool>> {
@@ -194,10 +194,12 @@ class _ImportedVisitor extends GeneralizingAstVisitor<Future<bool>> {
var directive = node.getAncestor((parent) => parent is NamespaceDirective);
if (directive is NamespaceDirective) {
LibraryElement library = directive.uriElement;
- LibraryElementSuggestionBuilder.suggestionsFor(request, library);
+ LibraryElementSuggestionBuilder.suggestionsFor(
+ request,
+ CompletionSuggestionKind.IDENTIFIER,
+ library);
return new Future.value(true);
}
-
return new Future.value(false);
}
@@ -219,12 +221,9 @@ class _ImportedVisitor extends GeneralizingAstVisitor<Future<bool>> {
return;
}
- CompletionSuggestionKind kind =
- newCompletionSuggestionKind_fromElementKind(element.kind);
-
String completion = element.displayName;
CompletionSuggestion suggestion = new CompletionSuggestion(
- kind,
+ CompletionSuggestionKind.INVOCATION,
relevance,
completion,
completion.length,
@@ -381,7 +380,7 @@ class _ImportedVisitor extends GeneralizingAstVisitor<Future<bool>> {
String completion = importElem.prefix.displayName;
if (completion != null && completion.length > 0) {
CompletionSuggestion suggestion = new CompletionSuggestion(
- CompletionSuggestionKind.LIBRARY_PREFIX,
+ CompletionSuggestionKind.INVOCATION,
CompletionRelevance.DEFAULT,
completion,
completion.length,

Powered by Google App Engine
This is Rietveld 408576698