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

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

Issue 630863003: Stop sending launchData for non-analyzed files (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 6 years, 2 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/test/domain_execution_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/domain_execution.dart
diff --git a/pkg/analysis_server/lib/src/domain_execution.dart b/pkg/analysis_server/lib/src/domain_execution.dart
index 3461cd5a8055c22e42967b43a0fbc30c8c39e427..4c7714495c6f8ad1bfbc09c63afc078bf1c40175 100644
--- a/pkg/analysis_server/lib/src/domain_execution.dart
+++ b/pkg/analysis_server/lib/src/domain_execution.dart
@@ -142,6 +142,9 @@ class ExecutionDomainHandler implements RequestHandler {
void _fileAnalyzed(ChangeNotice notice) {
Source source = notice.source;
String filePath = source.fullName;
+ if (!_isInAnalysisRoot(filePath)) {
+ return;
+ }
AnalysisContext context = server.getAnalysisContext(filePath);
if (AnalysisEngine.isDartFileName(filePath)) {
ExecutableKind kind = ExecutableKind.NOT_EXECUTABLE;
@@ -166,6 +169,13 @@ class ExecutionDomainHandler implements RequestHandler {
}
}
+ /**
+ * Return `true` if the given [filePath] represents a file that is in an
+ * analysis root.
+ */
+ bool _isInAnalysisRoot(String filePath)
+ => server.contextDirectoryManager.isInAnalysisRoot(filePath);
+
void _reportCurrentFileStatus() {
Map<String, List<String>> dartToHtml = new HashMap<String, List<String>>();
Map<String, List<String>> htmlToDart = new HashMap<String, List<String>>();
@@ -175,41 +185,43 @@ class ExecutionDomainHandler implements RequestHandler {
List<Source> serverSources = context.launchableServerLibrarySources;
for (Source source in clientSources) {
if (serverSources.remove(source)) {
- server.sendNotification(
- new ExecutionLaunchDataParams(
- source.fullName,
- kind: ExecutableKind.EITHER).toNotification());
+ _sendKindNotification(source.fullName, ExecutableKind.EITHER);
} else {
- server.sendNotification(
- new ExecutionLaunchDataParams(
- source.fullName,
- kind: ExecutableKind.CLIENT).toNotification());
+ _sendKindNotification(source.fullName, ExecutableKind.CLIENT);
}
librarySources.remove(source);
}
for (Source source in serverSources) {
- server.sendNotification(
- new ExecutionLaunchDataParams(
- source.fullName,
- kind: ExecutableKind.SERVER).toNotification());
+ _sendKindNotification(source.fullName, ExecutableKind.SERVER);
librarySources.remove(source);
}
for (Source source in librarySources) {
- server.sendNotification(
- new ExecutionLaunchDataParams(
- source.fullName,
- kind: ExecutableKind.NOT_EXECUTABLE).toNotification());
+ _sendKindNotification(source.fullName, ExecutableKind.NOT_EXECUTABLE);
}
for (Source source in context.htmlSources) {
- List<Source> libraries = context.getLibrariesReferencedFromHtml(source);
- server.sendNotification(
- new ExecutionLaunchDataParams(
- source.fullName,
- referencedFiles: _getFullNames(libraries)).toNotification());
+ String filePath = source.fullName;
+ if (_isInAnalysisRoot(filePath)) {
+ List<Source> libraries = context.getLibrariesReferencedFromHtml(source);
+ server.sendNotification(
+ new ExecutionLaunchDataParams(
+ filePath,
+ referencedFiles: _getFullNames(libraries)).toNotification());
+ }
}
}
}
+ /**
+ * Send a notification indicating the [kind] of the file with the given
+ * [filePath], but only if the file is in an analysis root.
+ */
+ void _sendKindNotification(String filePath, ExecutableKind kind) {
+ if (_isInAnalysisRoot(filePath)) {
+ server.sendNotification(
+ new ExecutionLaunchDataParams(filePath, kind: kind).toNotification());
+ }
+ }
+
static List<String> _getFullNames(List<Source> sources) {
return sources.map((Source source) => source.fullName).toList();
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/domain_execution_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698