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

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

Issue 620293002: refactor library prefix suggestion generation (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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/local_computer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bd1fd8bc4d193a2bdd4f6c2683b8d6e7ebceab9f..d622334845b30167de447e6986b5bd78d7cec347 100644
--- a/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
@@ -100,7 +100,8 @@ class _ImportedVisitor extends GeneralizingAstVisitor<Future<bool>> {
ImportElement element = directive.element;
if (element != null) {
LibraryElement lib = element.importedLibrary;
- if (directive.prefix == null) {
+ SimpleIdentifier prefix = directive.prefix;
+ if (prefix == null) {
visibleLibs.add(lib);
directive.combinators.forEach((Combinator combinator) {
if (combinator is ShowCombinator) {
@@ -112,6 +113,19 @@ class _ImportedVisitor extends GeneralizingAstVisitor<Future<bool>> {
}
});
} else {
+ String completion = prefix.name;
+ if (completion != null && completion.length > 0) {
+ CompletionSuggestion suggestion = new CompletionSuggestion(
+ CompletionSuggestionKind.LIBRARY_PREFIX,
+ CompletionRelevance.DEFAULT,
+ completion,
+ completion.length,
+ 0,
+ element.isDeprecated,
+ false);
+ suggestion.element = new protocol.Element.fromEngine(lib);
+ request.suggestions.add(suggestion);
+ }
excludedLibs.add(lib);
}
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/local_computer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698