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

Side by Side Diff: pkg/analysis_server/lib/src/operation/operation_analysis.dart

Issue 2612723002: Implement 'analysis.analyzedFiles' notification with the new analysis driver. (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library operation.analysis; 5 library operation.analysis;
6 6
7 import 'package:analysis_server/src/analysis_server.dart'; 7 import 'package:analysis_server/src/analysis_server.dart';
8 import 'package:analysis_server/src/computer/computer_highlights.dart'; 8 import 'package:analysis_server/src/computer/computer_highlights.dart';
9 import 'package:analysis_server/src/computer/computer_highlights2.dart'; 9 import 'package:analysis_server/src/computer/computer_highlights2.dart';
10 import 'package:analysis_server/src/computer/computer_outline.dart'; 10 import 'package:analysis_server/src/computer/computer_outline.dart';
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 // errors 129 // errors
130 if (server.shouldSendErrorsNotificationFor(file)) { 130 if (server.shouldSendErrorsNotificationFor(file)) {
131 server.scheduleOperation( 131 server.scheduleOperation(
132 new _NotificationErrorsOperation(context, file, lineInfo, errors)); 132 new _NotificationErrorsOperation(context, file, lineInfo, errors));
133 } 133 }
134 } 134 }
135 135
136 void sendAnalysisNotificationAnalyzedFiles(AnalysisServer server) { 136 void sendAnalysisNotificationAnalyzedFiles(AnalysisServer server) {
137 _sendNotification(server, () { 137 _sendNotification(server, () {
138 // TODO(paulberry): if it proves to be too inefficient to recompute the set 138 // TODO(paulberry): if it proves to be too inefficient to recompute the set
Brian Wilkerson 2017/01/04 15:01:05 We can probably remove this TODO comment at this p
139 // of analyzed files each time analysis is complete, consider modifying the 139 // of analyzed files each time analysis is complete, consider modifying the
140 // analysis engine to update this set incrementally as analysis is 140 // analysis engine to update this set incrementally as analysis is
141 // performed. 141 // performed.
142 LibraryDependencyCollector collector = 142 Set<String> analyzedFiles;
143 new LibraryDependencyCollector(server.analysisContexts.toList()); 143 if (server.options.enableNewAnalysisDriver) {
144 Set<String> analyzedFiles = collector.collectLibraryDependencies(); 144 analyzedFiles = server.driverMap.values
145 .map((driver) => driver.knownFiles)
146 .expand((files) => files)
147 .toSet();
148 } else {
149 LibraryDependencyCollector collector =
150 new LibraryDependencyCollector(server.analysisContexts.toList());
151 analyzedFiles = collector.collectLibraryDependencies();
152 }
145 Set<String> prevAnalyzedFiles = server.prevAnalyzedFiles; 153 Set<String> prevAnalyzedFiles = server.prevAnalyzedFiles;
146 if (prevAnalyzedFiles != null && 154 if (prevAnalyzedFiles != null &&
147 prevAnalyzedFiles.length == analyzedFiles.length && 155 prevAnalyzedFiles.length == analyzedFiles.length &&
148 prevAnalyzedFiles.difference(analyzedFiles).isEmpty) { 156 prevAnalyzedFiles.difference(analyzedFiles).isEmpty) {
149 // No change to the set of analyzed files. No need to send another 157 // No change to the set of analyzed files. No need to send another
150 // notification. 158 // notification.
151 return; 159 return;
152 } 160 }
153 server.prevAnalyzedFiles = analyzedFiles; 161 server.prevAnalyzedFiles = analyzedFiles;
154 protocol.AnalysisAnalyzedFilesParams params = 162 protocol.AnalysisAnalyzedFilesParams params =
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 abstract class _SingleFileOperation extends SourceSensitiveOperation { 547 abstract class _SingleFileOperation extends SourceSensitiveOperation {
540 final String file; 548 final String file;
541 549
542 _SingleFileOperation(AnalysisContext context, this.file) : super(context); 550 _SingleFileOperation(AnalysisContext context, this.file) : super(context);
543 551
544 @override 552 @override
545 bool shouldBeDiscardedOnSourceChange(Source source) { 553 bool shouldBeDiscardedOnSourceChange(Source source) {
546 return source.fullName == file; 554 return source.fullName == file;
547 } 555 }
548 } 556 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698