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

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

Issue 367483002: Ignore bogus links, such as those created by emacs for files being edited. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | « no previous file | pkg/analysis_server/lib/src/resource.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_directory_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_directory_manager.dart b/pkg/analysis_server/lib/src/context_directory_manager.dart
index 75941f34a020ea2ee1f5c980082ca1ad3d9badf0..f1e689762fe0e1d1f6c6c1bad76964c60c0ebc52 100644
--- a/pkg/analysis_server/lib/src/context_directory_manager.dart
+++ b/pkg/analysis_server/lib/src/context_directory_manager.dart
@@ -144,14 +144,14 @@ abstract class ContextDirectoryManager {
// there is a pubspec.yaml?
break;
}
- if (_shouldFileBeAnalyzed(event.path)) {
- ChangeSet changeSet = new ChangeSet();
- Resource resource = resourceProvider.getResource(event.path);
- // If the file went away and was replaced by a folder before we
- // had a chance to process the event, resource might be a Folder. In
- // that case don't add it.
- if (resource is File) {
- File file = resource;
+ Resource resource = resourceProvider.getResource(event.path);
+ // If the file went away and was replaced by a folder before we
+ // had a chance to process the event, resource might be a Folder. In
+ // that case don't add it.
+ if (resource is File) {
+ File file = resource;
+ if (_shouldFileBeAnalyzed(file)) {
+ ChangeSet changeSet = new ChangeSet();
Source source = file.createSource(UriKind.FILE_URI);
changeSet.addedSource(source);
applyChangesToContext(folder, changeSet);
@@ -211,7 +211,7 @@ abstract class ContextDirectoryManager {
List<Resource> children = folder.getChildren();
for (Resource child in children) {
if (child is File) {
- if (_shouldFileBeAnalyzed(child.path)) {
+ if (_shouldFileBeAnalyzed(child)) {
Source source = child.createSource(UriKind.FILE_URI);
changeSet.addedSource(source);
info.sources[child.path] = source;
@@ -227,9 +227,17 @@ abstract class ContextDirectoryManager {
}
}
- static bool _shouldFileBeAnalyzed(String path) {
- return AnalysisEngine.isDartFileName(path)
- || AnalysisEngine.isHtmlFileName(path);
+ 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 | « no previous file | pkg/analysis_server/lib/src/resource.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698