Index: pkg/analyzer/lib/src/dart/analysis/driver.dart |
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart |
index d7dc7c6969bb9dc3e5fdfef010607af56780c7d3..20e6958ba1378466092e4fb86e5347b1b328cd7d 100644 |
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart |
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart |
@@ -203,7 +203,8 @@ class AnalysisDriver { |
* Return the [Stream] that produces [AnalysisResult]s for added files. |
* |
* Analysis starts when the client starts listening to the stream, and stops |
- * when the client cancels the subscription. |
+ * when the client cancels the subscription. Note that the stream supports |
+ * only one single subscriber. |
* |
* When the client starts listening, the analysis state transitions to |
* "analyzing" and an analysis result is produced for every added file prior |
@@ -309,8 +310,10 @@ class AnalysisDriver { |
* The results of analysis are eventually produced by the [results] stream. |
*/ |
void addFile(String path) { |
- _explicitFiles.add(path); |
- _filesToAnalyze.add(path); |
+ if (AnalysisEngine.isDartFileName(path)) { |
+ _explicitFiles.add(path); |
+ _filesToAnalyze.add(path); |
+ } |
_transitionToAnalyzing(); |
_hasWork.notify(); |
} |
@@ -334,9 +337,11 @@ class AnalysisDriver { |
* [changeFile] invocation. |
*/ |
void changeFile(String path) { |
- _changedFiles.add(path); |
- if (_explicitFiles.contains(path)) { |
- _filesToAnalyze.add(path); |
+ if (AnalysisEngine.isDartFileName(path)) { |
+ _changedFiles.add(path); |
+ if (_explicitFiles.contains(path)) { |
+ _filesToAnalyze.add(path); |
+ } |
} |
_transitionToAnalyzing(); |
_hasWork.notify(); |
@@ -367,6 +372,20 @@ class AnalysisDriver { |
} |
/** |
+ * Returns a [Future] that completes after pumping the event queue [times] |
+ * times. By default, this should pump the event queue enough times to allow |
+ * any code to run, as long as it's not waiting on some external event. |
+ */ |
+ Future pumpEventQueue([int times = 5000]) { |
+ if (times == 0) return new Future.value(); |
+ // We use a delayed future to allow microtask events to finish. The |
+ // Future.value or Future() constructors use scheduleMicrotask themselves and |
+ // would therefore not wait for microtask callbacks that are scheduled after |
+ // invoking this method. |
+ return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1)); |
+ } |
+ |
+ /** |
* Remove the file with the given [path] from the list of files to analyze. |
* |
* The [path] must be absolute and normalized. |
@@ -709,20 +728,6 @@ class AnalysisDriver { |
set.remove(element); |
return element; |
} |
- |
- /** |
- * Returns a [Future] that completes after pumping the event queue [times] |
- * times. By default, this should pump the event queue enough times to allow |
- * any code to run, as long as it's not waiting on some external event. |
- */ |
- Future pumpEventQueue([int times = 5000]) { |
- if (times == 0) return new Future.value(); |
- // We use a delayed future to allow microtask events to finish. The |
- // Future.value or Future() constructors use scheduleMicrotask themselves and |
- // would therefore not wait for microtask callbacks that are scheduled after |
- // invoking this method. |
- return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1)); |
- } |
} |
/** |