| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analysis.server; | 5 library analysis.server; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:core'; | 9 import 'dart:core'; |
| 10 import 'dart:io' as io; | 10 import 'dart:io' as io; |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 } | 1099 } |
| 1100 } | 1100 } |
| 1101 | 1101 |
| 1102 /** | 1102 /** |
| 1103 * Implementation for `analysis.setSubscriptions`. | 1103 * Implementation for `analysis.setSubscriptions`. |
| 1104 */ | 1104 */ |
| 1105 void setAnalysisSubscriptions( | 1105 void setAnalysisSubscriptions( |
| 1106 Map<AnalysisService, Set<String>> subscriptions) { | 1106 Map<AnalysisService, Set<String>> subscriptions) { |
| 1107 if (options.enableNewAnalysisDriver) { | 1107 if (options.enableNewAnalysisDriver) { |
| 1108 this.analysisServices = subscriptions; | 1108 this.analysisServices = subscriptions; |
| 1109 // TODO(scheglov) send notifications for new files | 1109 Iterable<nd.AnalysisDriver> drivers = driverMap.values; |
| 1110 if (drivers.isNotEmpty) { |
| 1111 Set<String> allNewFiles = |
| 1112 subscriptions.values.expand((files) => files).toSet(); |
| 1113 for (String file in allNewFiles) { |
| 1114 nd.AnalysisDriver driver = drivers.firstWhere( |
| 1115 (driver) => driver.isAddedFile(file), |
| 1116 orElse: () => drivers.first); |
| 1117 // The result will be produced by the "results" stream with |
| 1118 // the fully resolved unit, and processed with sending analysis |
| 1119 // notifications as it happens after content changes. |
| 1120 driver.getResult(file); |
| 1121 } |
| 1122 } |
| 1110 return; | 1123 return; |
| 1111 } | 1124 } |
| 1112 // send notifications for already analyzed sources | 1125 // send notifications for already analyzed sources |
| 1113 subscriptions.forEach((service, Set<String> newFiles) { | 1126 subscriptions.forEach((service, Set<String> newFiles) { |
| 1114 Set<String> oldFiles = analysisServices[service]; | 1127 Set<String> oldFiles = analysisServices[service]; |
| 1115 Set<String> todoFiles = | 1128 Set<String> todoFiles = |
| 1116 oldFiles != null ? newFiles.difference(oldFiles) : newFiles; | 1129 oldFiles != null ? newFiles.difference(oldFiles) : newFiles; |
| 1117 for (String file in todoFiles) { | 1130 for (String file in todoFiles) { |
| 1118 if (contextManager.isIgnored(file)) { | 1131 if (contextManager.isIgnored(file)) { |
| 1119 continue; | 1132 continue; |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1925 /** | 1938 /** |
| 1926 * The [PerformanceTag] for time spent in server request handlers. | 1939 * The [PerformanceTag] for time spent in server request handlers. |
| 1927 */ | 1940 */ |
| 1928 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1941 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 1929 | 1942 |
| 1930 /** | 1943 /** |
| 1931 * The [PerformanceTag] for time spent in split store microtasks. | 1944 * The [PerformanceTag] for time spent in split store microtasks. |
| 1932 */ | 1945 */ |
| 1933 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1946 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1934 } | 1947 } |
| OLD | NEW |