Chromium Code Reviews| 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..8b461b920fd271a2c6f94be7f7bbbbb2acd06c1c 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,43 @@ 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) { |
|
Paul Berry
2014/06/16 23:43:16
I don't think this algorithm will do the right thi
Brian Wilkerson
2014/06/17 17:46:16
Good catch! Thanks!
|
| + 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; |
| + } |
| + String uri = new Uri.file(file).toString(); |
| + Source source = analysisContext.sourceFactory.forUri(uri); |
| + sourceList.add(source); |
| + } |
| + }); |
| + if (unanalyzed.isNotEmpty) { |
| + StringBuffer buffer = new StringBuffer(); |
| + buffer.writeAll(unanalyzed, ', '); |
| + throw new RequestFailure(new Response.unanalyzedPriorityFiles(request, |
| + buffer.toString())); |
| } |
| + sourceMap.forEach((AnalysisContext context, List<Source> sourceList) { |
| + context.analysisPriorityOrder = sourceList; |
| + }); |
| } |
| /** |
| @@ -411,13 +451,6 @@ class AnalysisServer { |
| } |
| /** |
| - * Send the given [notification] to the client. |
| - */ |
| - void sendNotification(Notification notification) { |
| - channel.sendNotification(notification); |
| - } |
| - |
| - /** |
| * Schedules [performOperation] exection. |
| */ |
| void _schedulePerformOperation() { |