OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analysis_server.src.plugin.server_plugin; | 5 library analysis_server.src.plugin.server_plugin; |
6 | 6 |
7 import 'package:analysis_server/plugin/analysis/analysis_domain.dart'; | 7 import 'package:analysis_server/plugin/analysis/analysis_domain.dart'; |
8 import 'package:analysis_server/plugin/analysis/analyzed_files.dart'; | 8 import 'package:analysis_server/plugin/analysis/analyzed_files.dart'; |
9 import 'package:analysis_server/plugin/analysis/navigation/navigation.dart'; | 9 import 'package:analysis_server/plugin/analysis/navigation/navigation.dart'; |
10 import 'package:analysis_server/plugin/analysis/navigation/navigation_core.dart' ; | 10 import 'package:analysis_server/plugin/analysis/navigation/navigation_core.dart' ; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 * Initialize a newly created plugin. | 156 * Initialize a newly created plugin. |
157 */ | 157 */ |
158 ServerPlugin(); | 158 ServerPlugin(); |
159 | 159 |
160 /** | 160 /** |
161 * Return a list containing all of the file patterns that can cause files to | 161 * Return a list containing all of the file patterns that can cause files to |
162 * be analyzed. | 162 * be analyzed. |
163 */ | 163 */ |
164 List<String> get analyzedFilePatterns { | 164 List<String> get analyzedFilePatterns { |
165 List<String> patterns = <String>[]; | 165 List<String> patterns = <String>[]; |
166 for (List<String> extension | 166 for (Object extension in analyzedFilePatternsExtensionPoint.extensions) { |
scheglov
2016/03/31 00:53:18
Should we make ExtensionPoint parameterized?
Brian Wilkerson
2016/03/31 15:27:12
I thought about that, and I like the idea, but I d
| |
167 in analyzedFilePatternsExtensionPoint.extensions) { | 167 patterns.addAll(extension as List<String>); |
168 patterns.addAll(extension); | |
169 } | 168 } |
170 return patterns; | 169 return patterns; |
171 } | 170 } |
172 | 171 |
173 /** | 172 /** |
174 * Return a list containing all of the assist contributors that were | 173 * Return a list containing all of the assist contributors that were |
175 * contributed. | 174 * contributed. |
176 */ | 175 */ |
177 List<AssistContributor> get assistContributors => | 176 List<AssistContributor> get assistContributors => |
178 assistContributorExtensionPoint.extensions; | 177 assistContributorExtensionPoint.extensions; |
179 | 178 |
180 /** | 179 /** |
181 * Return a list containing all of the completion contributors that were | 180 * Return a list containing all of the completion contributors that were |
182 * contributed. | 181 * contributed. |
183 */ | 182 */ |
184 Iterable<CompletionContributor> get completionContributors => | 183 Iterable<CompletionContributor> get completionContributors => |
185 completionContributorExtensionPoint.extensions | 184 completionContributorExtensionPoint.extensions |
186 .map((CompletionContributorFactory factory) => factory()); | 185 .map((Object factory) => (factory as CompletionContributorFactory)()); |
187 | 186 |
188 /** | 187 /** |
189 * Return a list containing all of the fix contributors that were contributed. | 188 * Return a list containing all of the fix contributors that were contributed. |
190 */ | 189 */ |
191 List<FixContributor> get fixContributors => | 190 List<FixContributor> get fixContributors => |
192 fixContributorExtensionPoint.extensions; | 191 fixContributorExtensionPoint.extensions; |
193 | 192 |
194 /** | 193 /** |
195 * Return a list containing all of the navigation contributors that were | 194 * Return a list containing all of the navigation contributors that were |
196 * contributed. | 195 * contributed. |
(...skipping 20 matching lines...) Expand all Loading... | |
217 | 216 |
218 /** | 217 /** |
219 * Use the given [server] to create all of the domains ([RequestHandler]'s) | 218 * Use the given [server] to create all of the domains ([RequestHandler]'s) |
220 * that have been registered and return the newly created domains. | 219 * that have been registered and return the newly created domains. |
221 */ | 220 */ |
222 List<RequestHandler> createDomains(AnalysisServer server) { | 221 List<RequestHandler> createDomains(AnalysisServer server) { |
223 if (domainExtensionPoint == null) { | 222 if (domainExtensionPoint == null) { |
224 return <RequestHandler>[]; | 223 return <RequestHandler>[]; |
225 } | 224 } |
226 return domainExtensionPoint.extensions | 225 return domainExtensionPoint.extensions |
227 .map((RequestHandlerFactory factory) => factory(server)) | 226 .map((Object factory) => (factory as RequestHandlerFactory)(server)) |
228 .toList(); | 227 .toList(); |
229 } | 228 } |
230 | 229 |
231 @override | 230 @override |
232 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) { | 231 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) { |
233 setAnalysisDomainExtensionPoint = registerExtensionPoint( | 232 setAnalysisDomainExtensionPoint = registerExtensionPoint( |
234 SET_ANALISYS_DOMAIN_EXTENSION_POINT, | 233 SET_ANALISYS_DOMAIN_EXTENSION_POINT, |
235 _validateSetAnalysisDomainFunction); | 234 _validateSetAnalysisDomainFunction); |
236 analyzedFilePatternsExtensionPoint = registerExtensionPoint( | 235 analyzedFilePatternsExtensionPoint = registerExtensionPoint( |
237 ANALYZED_FILE_PATTERNS_EXTENSION_POINT, | 236 ANALYZED_FILE_PATTERNS_EXTENSION_POINT, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 * valid analysis domain receiver. | 407 * valid analysis domain receiver. |
409 */ | 408 */ |
410 void _validateSetAnalysisDomainFunction(Object extension) { | 409 void _validateSetAnalysisDomainFunction(Object extension) { |
411 if (extension is! SetAnalysisDomain) { | 410 if (extension is! SetAnalysisDomain) { |
412 String id = setAnalysisDomainExtensionPoint.uniqueIdentifier; | 411 String id = setAnalysisDomainExtensionPoint.uniqueIdentifier; |
413 throw new ExtensionError( | 412 throw new ExtensionError( |
414 'Extensions to $id must be a SetAnalysisDomain function'); | 413 'Extensions to $id must be a SetAnalysisDomain function'); |
415 } | 414 } |
416 } | 415 } |
417 } | 416 } |
OLD | NEW |