OLD | NEW |
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_navigation.dart'; | 9 import 'package:analysis_server/src/computer/computer_navigation.dart'; |
10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; | 10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; |
11 import 'package:analysis_server/src/computer/computer_outline.dart'; | 11 import 'package:analysis_server/src/computer/computer_outline.dart'; |
12 import 'package:analysis_server/src/computer/computer_overrides.dart'; | 12 import 'package:analysis_server/src/computer/computer_overrides.dart'; |
13 import 'package:analysis_server/src/operation/operation.dart'; | 13 import 'package:analysis_server/src/operation/operation.dart'; |
14 import 'package:analysis_server/src/protocol_server.dart' as protocol; | 14 import 'package:analysis_server/src/protocol_server.dart' as protocol; |
| 15 import 'package:analysis_server/src/services/dependencies/library_dependencies.d
art'; |
15 import 'package:analysis_server/src/services/index/index.dart'; | 16 import 'package:analysis_server/src/services/index/index.dart'; |
16 import 'package:analyzer/src/generated/ast.dart'; | 17 import 'package:analyzer/src/generated/ast.dart'; |
17 import 'package:analyzer/src/generated/engine.dart'; | 18 import 'package:analyzer/src/generated/engine.dart'; |
18 import 'package:analyzer/src/generated/error.dart'; | 19 import 'package:analyzer/src/generated/error.dart'; |
19 import 'package:analyzer/src/generated/html.dart'; | 20 import 'package:analyzer/src/generated/html.dart'; |
20 import 'package:analyzer/src/generated/source.dart'; | 21 import 'package:analyzer/src/generated/source.dart'; |
21 | 22 |
22 /** | 23 /** |
23 * Runs the given function [f] with the working cache size in [context]. | 24 * Runs the given function [f] with the working cache size in [context]. |
24 * Returns the result of [f] invocation. | 25 * Returns the result of [f] invocation. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 new _DartOutlineOperation(context, file, lineInfo, dartUnit)); | 92 new _DartOutlineOperation(context, file, lineInfo, dartUnit)); |
92 } | 93 } |
93 } | 94 } |
94 // errors | 95 // errors |
95 if (server.shouldSendErrorsNotificationFor(file)) { | 96 if (server.shouldSendErrorsNotificationFor(file)) { |
96 server.scheduleOperation( | 97 server.scheduleOperation( |
97 new _NotificationErrorsOperation(context, file, lineInfo, errors)); | 98 new _NotificationErrorsOperation(context, file, lineInfo, errors)); |
98 } | 99 } |
99 } | 100 } |
100 | 101 |
| 102 void sendAnalysisNotificationAnalyzedFiles(AnalysisServer server) { |
| 103 _sendNotification(server, () { |
| 104 LibraryDependencyCollector collector = |
| 105 new LibraryDependencyCollector(server.getAnalysisContexts().toList()); |
| 106 Set<String> directories = collector.collectLibraryDependencies(); |
| 107 protocol.AnalysisAnalyzedFilesParams params = |
| 108 new protocol.AnalysisAnalyzedFilesParams(directories.toList()); |
| 109 server.sendNotification(params.toNotification()); |
| 110 }); |
| 111 } |
| 112 |
101 void sendAnalysisNotificationErrors(AnalysisServer server, String file, | 113 void sendAnalysisNotificationErrors(AnalysisServer server, String file, |
102 LineInfo lineInfo, List<AnalysisError> errors) { | 114 LineInfo lineInfo, List<AnalysisError> errors) { |
103 _sendNotification(server, () { | 115 _sendNotification(server, () { |
104 if (errors == null) { | 116 if (errors == null) { |
105 errors = <AnalysisError>[]; | 117 errors = <AnalysisError>[]; |
106 } | 118 } |
107 var serverErrors = | 119 var serverErrors = |
108 protocol.doAnalysisError_listFromEngine(lineInfo, errors); | 120 protocol.doAnalysisError_listFromEngine(lineInfo, errors); |
109 var params = new protocol.AnalysisErrorsParams(file, serverErrors); | 121 var params = new protocol.AnalysisErrorsParams(file, serverErrors); |
110 server.sendNotification(params.toNotification()); | 122 server.sendNotification(params.toNotification()); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 abstract class _SingleFileOperation extends SourceSensitiveOperation { | 453 abstract class _SingleFileOperation extends SourceSensitiveOperation { |
442 final String file; | 454 final String file; |
443 | 455 |
444 _SingleFileOperation(AnalysisContext context, this.file) : super(context); | 456 _SingleFileOperation(AnalysisContext context, this.file) : super(context); |
445 | 457 |
446 @override | 458 @override |
447 bool shouldBeDiscardedOnSourceChange(Source source) { | 459 bool shouldBeDiscardedOnSourceChange(Source source) { |
448 return source.fullName == file; | 460 return source.fullName == file; |
449 } | 461 } |
450 } | 462 } |
OLD | NEW |