| 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 c6086ace2a4a8ae9167795faa9f5938bd6732308..d9ede460d01115e9772c932644228848a8e77ea9 100644
|
| --- a/pkg/analysis_server/lib/src/analysis_server.dart
|
| +++ b/pkg/analysis_server/lib/src/analysis_server.dart
|
| @@ -147,6 +147,17 @@ class AnalysisServer {
|
| }
|
|
|
| /**
|
| + * Schedules execution of the given [ServerOperation].
|
| + */
|
| + void scheduleOperation(ServerOperation operation) {
|
| + bool wasEmpty = operationQueue.isEmpty;
|
| + addOperation(operation);
|
| + if (wasEmpty) {
|
| + _schedulePerformOperation();
|
| + }
|
| + }
|
| +
|
| + /**
|
| * Schedules analysis of the given context.
|
| */
|
| void schedulePerformAnalysisOperation(AnalysisContext context) {
|
| @@ -154,14 +165,46 @@ class AnalysisServer {
|
| }
|
|
|
| /**
|
| - * Schedules execution of the given [ServerOperation].
|
| + * Send the given [notification] to the client.
|
| */
|
| - void scheduleOperation(ServerOperation operation) {
|
| - bool wasEmpty = operationQueue.isEmpty;
|
| - addOperation(operation);
|
| - if (wasEmpty) {
|
| - _schedulePerformOperation();
|
| + void sendNotification(Notification notification) {
|
| + channel.sendNotification(notification);
|
| + }
|
| +
|
| + /**
|
| + * Set the priority files to the given [files].
|
| + */
|
| + void setPriorityFiles(Request request, List<String> files) {
|
| + Map<AnalysisContext, List<Source>> sourceMap =
|
| + new HashMap<AnalysisContext, List<Source>>();
|
| + List<String> unanalyzed = new List<String>();
|
| + files.forEach((file) {
|
| + AnalysisContext analysisContext = _getAnalysisContext(file);
|
| + if (analysisContext == null) {
|
| + unanalyzed.add(file);
|
| + } else {
|
| + List<Source> sourceList = sourceMap[analysisContext];
|
| + if (sourceList == null) {
|
| + sourceList = <Source>[];
|
| + sourceMap[analysisContext] = sourceList;
|
| + }
|
| + sourceList.add(_getSource(file));
|
| + }
|
| + });
|
| + if (unanalyzed.isNotEmpty) {
|
| + StringBuffer buffer = new StringBuffer();
|
| + buffer.writeAll(unanalyzed, ', ');
|
| + throw new RequestFailure(new Response.unanalyzedPriorityFiles(request,
|
| + buffer.toString()));
|
| }
|
| + folderMap.forEach((Folder folder, ContextDirectory directory) {
|
| + AnalysisContext context = directory.context;
|
| + List<Source> sourceList = sourceMap[context];
|
| + if (sourceList == null) {
|
| + sourceList = Source.EMPTY_ARRAY;
|
| + }
|
| + context.analysisPriorityOrder = sourceList;
|
| + });
|
| }
|
|
|
| /**
|
| @@ -187,6 +230,23 @@ class AnalysisServer {
|
| running = false;
|
| }
|
|
|
| +// 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;
|
| +// }
|
| +
|
| /**
|
| * Handle a [request] that was read from the communication channel.
|
| */
|
| @@ -411,13 +471,6 @@ class AnalysisServer {
|
| }
|
|
|
| /**
|
| - * Send the given [notification] to the client.
|
| - */
|
| - void sendNotification(Notification notification) {
|
| - channel.sendNotification(notification);
|
| - }
|
| -
|
| - /**
|
| * Schedules [performOperation] exection.
|
| */
|
| void _schedulePerformOperation() {
|
|
|