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

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 332993006: Implemented analysis.setPrioritySource (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 months 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/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() {
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/constants.dart » ('j') | pkg/analysis_server/lib/src/domain_edit.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698