Index: pkg/analysis_server/lib/src/analysis_server.dart |
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart |
index c8108b88b6089f19a6bc3b9ce164a978db7b5686..964ece2d88f33f99008abaac2260111cb15e5fb9 100644 |
--- a/pkg/analysis_server/lib/src/analysis_server.dart |
+++ b/pkg/analysis_server/lib/src/analysis_server.dart |
@@ -450,6 +450,26 @@ class AnalysisServer { |
return folderMap.values; |
} |
+ CompilationUnitElement getCompilationUnitElement(String file) { |
+ ContextSourcePair pair = getContextSourcePair(file); |
+ if (pair == null) { |
+ return null; |
+ } |
+ // prepare AnalysisContext and Source |
+ AnalysisContext context = pair.context; |
+ Source unitSource = pair.source; |
+ if (context == null || unitSource == null) { |
+ return null; |
+ } |
+ // get element in the first library |
+ List<Source> librarySources = context.getLibrariesContaining(unitSource); |
+ if (!librarySources.isNotEmpty) { |
+ return null; |
+ } |
+ Source librarySource = librarySources.first; |
+ return context.getCompilationUnitElement(unitSource, librarySource); |
+ } |
+ |
/** |
* Return the [AnalysisContext] that contains the given [path]. |
* Return `null` if no context contains the [path]. |
@@ -564,6 +584,23 @@ class AnalysisServer { |
return elements; |
} |
+// TODO(brianwilkerson) Add the following method after 'prioritySources' has |
+// been added to InternalAnalysisContext. |
+// /** |
+// * Return a list containing the full names of all of the sources that are |
+// * priority sources. |
+// */ |
+// List<String> getPriorityFiles() { |
+// List<String> priorityFiles = new List<String>(); |
+// folderMap.values.forEach((ContextDirectory directory) { |
+// InternalAnalysisContext context = directory.context; |
+// context.prioritySources.forEach((Source source) { |
+// priorityFiles.add(source.fullName); |
+// }); |
+// }); |
+// return priorityFiles; |
+// } |
+ |
/** |
* Return an analysis error info containing the array of all of the errors and |
* the line info associated with [file]. |
@@ -590,23 +627,6 @@ class AnalysisServer { |
return context.getErrors(source); |
} |
-// TODO(brianwilkerson) Add the following method after 'prioritySources' has |
-// been added to InternalAnalysisContext. |
-// /** |
-// * Return a list containing the full names of all of the sources that are |
-// * priority sources. |
-// */ |
-// List<String> getPriorityFiles() { |
-// List<String> priorityFiles = new List<String>(); |
-// folderMap.values.forEach((ContextDirectory directory) { |
-// InternalAnalysisContext context = directory.context; |
-// context.prioritySources.forEach((Source source) { |
-// priorityFiles.add(source.fullName); |
-// }); |
-// }); |
-// return priorityFiles; |
-// } |
- |
/** |
* Returns resolved [AstNode]s at the given [offset] of the given [file]. |
* |
@@ -790,6 +810,7 @@ class AnalysisServer { |
sendAnalysisNotificationAnalyzedFiles(this); |
} |
sendStatusNotification(null); |
+ _scheduleAnalysisImplementedNotification(); |
if (_onAnalysisCompleteCompleter != null) { |
_onAnalysisCompleteCompleter.complete(); |
_onAnalysisCompleteCompleter = null; |
@@ -993,6 +1014,11 @@ class AnalysisServer { |
}); |
// remember new subscriptions |
this.analysisServices = subscriptions; |
+ // special case for implemented elements |
+ if (analysisServices.containsKey(AnalysisService.IMPLEMENTED) && |
+ isAnalysisComplete()) { |
+ _scheduleAnalysisImplementedNotification(); |
+ } |
} |
/** |
@@ -1282,6 +1308,13 @@ class AnalysisServer { |
}); |
} |
+ _scheduleAnalysisImplementedNotification() async { |
+ Set<String> files = analysisServices[AnalysisService.IMPLEMENTED]; |
+ if (files != null) { |
+ scheduleImplementedNotification(this, files); |
+ } |
+ } |
+ |
/** |
* Schedules [performOperation] exection. |
*/ |