| 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 fe370927919c770f5e6524f6f47b223e9ad275b7..a22769431d6c4144556bfd1fa8455d1aa70a84fe 100644
|
| --- a/pkg/analysis_server/lib/src/analysis_server.dart
|
| +++ b/pkg/analysis_server/lib/src/analysis_server.dart
|
| @@ -174,11 +174,6 @@ class AnalysisServer {
|
| bool rethrowExceptions;
|
|
|
| /**
|
| - * The stream that is notified when contexts are added or removed.
|
| - */
|
| - Stream<ContextsChangedEvent> onContextsChanged;
|
| -
|
| - /**
|
| * Initialize a newly created server to receive requests from and send
|
| * responses to the given [channel].
|
| *
|
| @@ -194,8 +189,6 @@ class AnalysisServer {
|
| operationQueue = new ServerOperationQueue(this);
|
| contextDirectoryManager =
|
| new ServerContextManager(this, resourceProvider, packageMapProvider);
|
| - onContextsChanged =
|
| - contextDirectoryManager.onContextsChanged.asBroadcastStream();
|
| AnalysisEngine.instance.logger = new AnalysisLogger();
|
| _onAnalysisStartedController = new StreamController.broadcast();
|
| _onAnalysisCompleteController = new StreamController.broadcast();
|
| @@ -221,6 +214,12 @@ class AnalysisServer {
|
| }
|
|
|
| /**
|
| + * The stream that is notified when contexts are added or removed.
|
| + */
|
| + Stream<ContextsChangedEvent> get onContextsChanged =>
|
| + contextDirectoryManager.onContextsChanged;
|
| +
|
| + /**
|
| * The stream that is notified when a single file has been analyzed.
|
| */
|
| Stream get onFileAnalyzed => _onFileAnalyzedController.stream;
|
| @@ -394,6 +393,32 @@ class AnalysisServer {
|
| }
|
|
|
| /**
|
| + * Returns resolved [CompilationUnit]s of the Dart file with the given [path].
|
| + *
|
| + * May be empty, but not `null`.
|
| + */
|
| + List<CompilationUnit> getResolvedCompilationUnits(String path) {
|
| + List<CompilationUnit> units = <CompilationUnit>[];
|
| + // prepare AnalysisContext
|
| + AnalysisContext context = getAnalysisContext(path);
|
| + if (context == null) {
|
| + return units;
|
| + }
|
| + // add a unit for each unit/library combination
|
| + Source unitSource = getSource(path);
|
| + List<Source> librarySources = context.getLibrariesContaining(unitSource);
|
| + for (Source librarySource in librarySources) {
|
| + CompilationUnit unit =
|
| + context.resolveCompilationUnit2(unitSource, librarySource);
|
| + if (unit != null) {
|
| + units.add(unit);
|
| + }
|
| + }
|
| + // done
|
| + return units;
|
| + }
|
| +
|
| + /**
|
| * Returns the [CompilationUnit] of the Dart file with the given [path] that
|
| * should be used to resend notifications for already resolved unit.
|
| * Returns `null` if the file is not a part of any context, library has not
|
| @@ -421,32 +446,6 @@ class AnalysisServer {
|
| }
|
|
|
| /**
|
| - * Returns resolved [CompilationUnit]s of the Dart file with the given [path].
|
| - *
|
| - * May be empty, but not `null`.
|
| - */
|
| - List<CompilationUnit> getResolvedCompilationUnits(String path) {
|
| - List<CompilationUnit> units = <CompilationUnit>[];
|
| - // prepare AnalysisContext
|
| - AnalysisContext context = getAnalysisContext(path);
|
| - if (context == null) {
|
| - return units;
|
| - }
|
| - // add a unit for each unit/library combination
|
| - Source unitSource = getSource(path);
|
| - List<Source> librarySources = context.getLibrariesContaining(unitSource);
|
| - for (Source librarySource in librarySources) {
|
| - CompilationUnit unit =
|
| - context.resolveCompilationUnit2(unitSource, librarySource);
|
| - if (unit != null) {
|
| - units.add(unit);
|
| - }
|
| - }
|
| - // done
|
| - return units;
|
| - }
|
| -
|
| - /**
|
| * Return the [Source] of the Dart file with the given [path].
|
| */
|
| Source getSource(String path) {
|
| @@ -942,8 +941,7 @@ class ContextsChangedEvent {
|
| }
|
|
|
| /**
|
| - * A [PriorityChangeEvent] indicates which sources are currently prioritized
|
| - * and should be analyzed before other sources.
|
| + * A [PriorityChangeEvent] indicates the set the priority files has changed.
|
| */
|
| class PriorityChangeEvent {
|
| final Source firstSource;
|
| @@ -967,7 +965,8 @@ class ServerContextManager extends ContextManager {
|
| ServerContextManager(this.analysisServer, ResourceProvider resourceProvider,
|
| PackageMapProvider packageMapProvider)
|
| : super(resourceProvider, packageMapProvider) {
|
| - _onContextsChangedController = new StreamController<ContextsChangedEvent>();
|
| + _onContextsChangedController =
|
| + new StreamController<ContextsChangedEvent>.broadcast();
|
| }
|
|
|
| /**
|
|
|