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

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

Issue 1514603002: suggest after import prefix in part files - fixes #25023 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years 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/library_member_contributor.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/library_member_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/library_member_contributor.dart
index 2d12d7053a811e8e6a35585dbe5577df17cc11f6..bfbbc0b96152876dbe1362272b4c2ca49307c409 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/library_member_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/library_member_contributor.dart
@@ -33,9 +33,10 @@ class LibraryMemberContributor extends DartCompletionContributor {
// Resolve the expression and the containing library
await request.resolveExpression(targetId);
LibraryElement containingLibrary = await request.libraryElement;
- // Gracefully degrade if the library could not be determined
+ List<Directive> directives = await request.resolveDirectives();
+ // Gracefully degrade if the library or directives could not be determined
// e.g. detached part file or source change
- if (containingLibrary == null) {
+ if (containingLibrary == null || directives == null) {
return EMPTY_LIST;
}
@@ -51,7 +52,7 @@ class LibraryMemberContributor extends DartCompletionContributor {
List<CompletionSuggestion> suggestions = <CompletionSuggestion>[];
// Find the import directive with the given prefix
- for (Directive directive in request.target.unit.directives) {
+ for (Directive directive in directives) {
if (directive is ImportDirective) {
if (directive.prefix != null) {
if (directive.prefix.name == elem.name) {

Powered by Google App Engine
This is Rietveld 408576698