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

Unified Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 2463723004: Ignore adding and changing non-Dart files. (Closed)
Patch Set: Switch to using AnalysisEngine.isDartFileName(). Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
- }
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698