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

Unified Diff: pkg/analyzer_plugin/lib/plugin/plugin.dart

Issue 2886343002: Register files with new drivers (issue 29641) (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | pkg/analyzer_plugin/test/plugin/plugin_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_plugin/lib/plugin/plugin.dart
diff --git a/pkg/analyzer_plugin/lib/plugin/plugin.dart b/pkg/analyzer_plugin/lib/plugin/plugin.dart
index 4bbe1fae1f67c340d5fc5e6059b302a5a7c1cf52..5c84f5151e9b4fd9a3314f263424799ced743240 100644
--- a/pkg/analyzer_plugin/lib/plugin/plugin.dart
+++ b/pkg/analyzer_plugin/lib/plugin/plugin.dart
@@ -269,6 +269,10 @@ abstract class ServerPlugin {
// has the side-effect of adding it to the analysis driver scheduler.
AnalysisDriverGeneric driver = createAnalysisDriver(contextRoot);
driverMap[contextRoot] = driver;
+ _addFilesToDriver(
+ driver,
+ resourceProvider.getResource(contextRoot.root),
+ contextRoot.exclude);
}
}
for (ContextRoot contextRoot in oldRoots) {
@@ -459,6 +463,25 @@ abstract class ServerPlugin {
}
/**
+ * Add all of the files contained in the given [resource] that are not in the
+ * list of [excluded] resources to the given [driver].
+ */
+ void _addFilesToDriver(
+ AnalysisDriverGeneric driver, Resource resource, List<String> excluded) {
+ String path = resource.path;
+ if (excluded.contains(path) || !resource.exists) {
scheglov 2017/05/18 01:20:40 It does not guarantee anything that the resource e
Brian Wilkerson 2017/05/18 14:43:36 I removed the existence check.
+ return;
+ }
+ if (resource is File) {
+ driver.addFile(path);
+ } else if (resource is Folder) {
+ for (Resource child in resource.getChildren()) {
scheglov 2017/05/18 01:20:40 getChildren() should be wrapped with try/catch in
Brian Wilkerson 2017/05/18 14:43:36 Done
+ _addFilesToDriver(driver, child, excluded);
+ }
+ }
+ }
+
+ /**
* Compute the response that should be returned for the given [request], or
* `null` if the response has already been sent.
*/
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | pkg/analyzer_plugin/test/plugin/plugin_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698