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

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

Issue 1152013002: Add support for specifying files needing analysis (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/edit/edit_domain.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/context_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index e010a3e505be57eb287ae80e43f1d874116fe46d..bfa8cb6fbd0c7fd383aefbde12a7d6ab2d3be71c 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -295,6 +295,11 @@ abstract class ContextManager {
}
/**
+ * Return `true` if the given [file] should be analyzed.
+ */
+ bool shouldFileBeAnalyzed(File file);
+
+ /**
* Called when the package map for a context has changed.
*/
void updateContextPackageUriResolver(
@@ -321,7 +326,7 @@ abstract class ContextManager {
// add files, recurse into folders
if (child is File) {
// ignore if should not be analyzed at all
- if (!_shouldFileBeAnalyzed(child)) {
+ if (!shouldFileBeAnalyzed(child)) {
continue;
}
// ignore if was not excluded
@@ -366,7 +371,7 @@ abstract class ContextManager {
}
// add files, recurse into folders
if (child is File) {
- if (_shouldFileBeAnalyzed(child)) {
+ if (shouldFileBeAnalyzed(child)) {
Source source = createSourceInContext(info.context, child);
changeSet.addedSource(source);
info.sources[path] = source;
@@ -580,7 +585,7 @@ abstract class ContextManager {
// that case don't add it.
if (resource is File) {
File file = resource;
- if (_shouldFileBeAnalyzed(file)) {
+ if (shouldFileBeAnalyzed(file)) {
ChangeSet changeSet = new ChangeSet();
Source source = createSourceInContext(info.context, file);
changeSet.addedSource(source);
@@ -706,19 +711,6 @@ abstract class ContextManager {
Uri uri = context.sourceFactory.restoreUri(source);
return file.createSource(uri);
}
-
- static bool _shouldFileBeAnalyzed(File file) {
- if (!(AnalysisEngine.isDartFileName(file.path) ||
- AnalysisEngine.isHtmlFileName(file.path))) {
- return false;
- }
- // Emacs creates dummy links to track the fact that a file is open for
- // editing and has unsaved changes (e.g. having unsaved changes to
- // 'foo.dart' causes a link '.#foo.dart' to be created, which points to the
- // non-existent file 'username@hostname.pid'. To avoid these dummy links
- // causing the analyzer to thrash, just ignore links to non-existent files.
- return file.exists;
- }
}
/**
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/edit/edit_domain.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698