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' ; |
11 import 'package:analysis_server/plugin/analysis/occurrences/occurrences.dart'; | 11 import 'package:analysis_server/plugin/analysis/occurrences/occurrences.dart'; |
12 import 'package:analysis_server/plugin/analysis/occurrences/occurrences_core.dar t'; | 12 import 'package:analysis_server/plugin/analysis/occurrences/occurrences_core.dar t'; |
13 import 'package:analysis_server/plugin/edit/assist/assist.dart'; | 13 import 'package:analysis_server/plugin/edit/assist/assist.dart'; |
14 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; | 14 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; |
15 import 'package:analysis_server/plugin/edit/fix/fix.dart'; | 15 import 'package:analysis_server/plugin/edit/fix/fix.dart'; |
16 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; | 16 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; |
17 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 17 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
18 import 'package:analysis_server/src/analysis_server.dart'; | 18 import 'package:analysis_server/src/analysis_server.dart'; |
19 import 'package:analysis_server/src/domain_analysis.dart'; | 19 import 'package:analysis_server/src/domain_analysis.dart'; |
20 import 'package:analysis_server/src/domain_completion.dart'; | 20 import 'package:analysis_server/src/domain_completion.dart'; |
21 import 'package:analysis_server/src/domain_diagnostic.dart'; | 21 import 'package:analysis_server/src/domain_diagnostic.dart'; |
22 import 'package:analysis_server/src/domain_execution.dart'; | 22 import 'package:analysis_server/src/domain_execution.dart'; |
23 import 'package:analysis_server/src/domain_server.dart'; | 23 import 'package:analysis_server/src/domain_server.dart'; |
24 import 'package:analysis_server/src/domains/analysis/navigation_dart.dart'; | 24 import 'package:analysis_server/src/domains/analysis/navigation_dart.dart'; |
25 import 'package:analysis_server/src/domains/analysis/occurrences_dart.dart'; | 25 import 'package:analysis_server/src/domains/analysis/occurrences_dart.dart'; |
26 import 'package:analysis_server/src/edit/edit_domain.dart'; | 26 import 'package:analysis_server/src/edit/edit_domain.dart'; |
27 import 'package:analysis_server/src/provisional/completion/completion_core.dart' ; | 27 import 'package:analysis_server/src/provisional/completion/completion_core.dart' ; |
28 import 'package:analysis_server/src/provisional/index/index.dart'; | |
29 import 'package:analysis_server/src/provisional/index/index_core.dart'; | |
30 import 'package:analysis_server/src/search/search_domain.dart'; | 28 import 'package:analysis_server/src/search/search_domain.dart'; |
31 import 'package:analysis_server/src/services/correction/assist_internal.dart'; | 29 import 'package:analysis_server/src/services/correction/assist_internal.dart'; |
32 import 'package:analysis_server/src/services/correction/fix_internal.dart'; | 30 import 'package:analysis_server/src/services/correction/fix_internal.dart'; |
33 import 'package:analysis_server/src/services/index/index_contributor.dart'; | |
34 import 'package:analyzer/src/generated/engine.dart'; | 31 import 'package:analyzer/src/generated/engine.dart'; |
35 import 'package:plugin/plugin.dart'; | 32 import 'package:plugin/plugin.dart'; |
36 | 33 |
37 /** | 34 /** |
38 * A function that will create a request handler that can be used by the given | 35 * A function that will create a request handler that can be used by the given |
39 * [server]. | 36 * [server]. |
40 */ | 37 */ |
41 typedef RequestHandler RequestHandlerFactory(AnalysisServer server); | 38 typedef RequestHandler RequestHandlerFactory(AnalysisServer server); |
42 | 39 |
43 /** | 40 /** |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 */ | 128 */ |
132 ExtensionPoint domainExtensionPoint; | 129 ExtensionPoint domainExtensionPoint; |
133 | 130 |
134 /** | 131 /** |
135 * The extension point that allows plugins to register fix contributors with | 132 * The extension point that allows plugins to register fix contributors with |
136 * the server. | 133 * the server. |
137 */ | 134 */ |
138 ExtensionPoint fixContributorExtensionPoint; | 135 ExtensionPoint fixContributorExtensionPoint; |
139 | 136 |
140 /** | 137 /** |
141 * The extension point that allows plugins to register index contributors. | |
142 */ | |
143 ExtensionPoint indexContributorExtensionPoint; | |
Brian Wilkerson
2016/03/14 18:57:32
Why are we getting rid of this? I thought we had p
scheglov
2016/03/14 19:18:38
AFAIK we don't have such plugins yet.
It was wor
| |
144 | |
145 /** | |
146 * The extension point that allows plugins to register navigation | 138 * The extension point that allows plugins to register navigation |
147 * contributors. | 139 * contributors. |
148 */ | 140 */ |
149 ExtensionPoint navigationContributorExtensionPoint; | 141 ExtensionPoint navigationContributorExtensionPoint; |
150 | 142 |
151 /** | 143 /** |
152 * The extension point that allows plugins to register occurrences | 144 * The extension point that allows plugins to register occurrences |
153 * contributors. | 145 * contributors. |
154 */ | 146 */ |
155 ExtensionPoint occurrencesContributorExtensionPoint; | 147 ExtensionPoint occurrencesContributorExtensionPoint; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 completionContributorExtensionPoint.extensions | 185 completionContributorExtensionPoint.extensions |
194 .map((CompletionContributorFactory factory) => factory()); | 186 .map((CompletionContributorFactory factory) => factory()); |
195 | 187 |
196 /** | 188 /** |
197 * Return a list containing all of the fix contributors that were contributed. | 189 * Return a list containing all of the fix contributors that were contributed. |
198 */ | 190 */ |
199 List<FixContributor> get fixContributors => | 191 List<FixContributor> get fixContributors => |
200 fixContributorExtensionPoint.extensions; | 192 fixContributorExtensionPoint.extensions; |
201 | 193 |
202 /** | 194 /** |
203 * Return a list containing all of the index contributors that were | |
204 * contributed. | |
205 */ | |
206 List<IndexContributor> get indexContributors => | |
207 indexContributorExtensionPoint.extensions; | |
208 | |
209 /** | |
210 * Return a list containing all of the navigation contributors that were | 195 * Return a list containing all of the navigation contributors that were |
211 * contributed. | 196 * contributed. |
212 */ | 197 */ |
213 List<NavigationContributor> get navigationContributors => | 198 List<NavigationContributor> get navigationContributors => |
214 navigationContributorExtensionPoint.extensions; | 199 navigationContributorExtensionPoint.extensions; |
215 | 200 |
216 /** | 201 /** |
217 * Return a list containing all of the occurrences contributors that were | 202 * Return a list containing all of the occurrences contributors that were |
218 * contributed. | 203 * contributed. |
219 */ | 204 */ |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 assistContributorExtensionPoint = registerExtensionPoint( | 239 assistContributorExtensionPoint = registerExtensionPoint( |
255 ASSIST_CONTRIBUTOR_EXTENSION_POINT, | 240 ASSIST_CONTRIBUTOR_EXTENSION_POINT, |
256 _validateAssistContributorExtension); | 241 _validateAssistContributorExtension); |
257 completionContributorExtensionPoint = registerExtensionPoint( | 242 completionContributorExtensionPoint = registerExtensionPoint( |
258 COMPLETION_CONTRIBUTOR_EXTENSION_POINT, | 243 COMPLETION_CONTRIBUTOR_EXTENSION_POINT, |
259 _validateCompletionContributorExtension); | 244 _validateCompletionContributorExtension); |
260 domainExtensionPoint = registerExtensionPoint( | 245 domainExtensionPoint = registerExtensionPoint( |
261 DOMAIN_EXTENSION_POINT, _validateDomainExtension); | 246 DOMAIN_EXTENSION_POINT, _validateDomainExtension); |
262 fixContributorExtensionPoint = registerExtensionPoint( | 247 fixContributorExtensionPoint = registerExtensionPoint( |
263 FIX_CONTRIBUTOR_EXTENSION_POINT, _validateFixContributorExtension); | 248 FIX_CONTRIBUTOR_EXTENSION_POINT, _validateFixContributorExtension); |
264 indexContributorExtensionPoint = registerExtensionPoint( | |
265 INDEX_CONTRIBUTOR_EXTENSION_POINT, _validateIndexContributorExtension); | |
266 navigationContributorExtensionPoint = registerExtensionPoint( | 249 navigationContributorExtensionPoint = registerExtensionPoint( |
267 NAVIGATION_CONTRIBUTOR_EXTENSION_POINT, | 250 NAVIGATION_CONTRIBUTOR_EXTENSION_POINT, |
268 _validateNavigationContributorExtension); | 251 _validateNavigationContributorExtension); |
269 occurrencesContributorExtensionPoint = registerExtensionPoint( | 252 occurrencesContributorExtensionPoint = registerExtensionPoint( |
270 OCCURRENCES_CONTRIBUTOR_EXTENSION_POINT, | 253 OCCURRENCES_CONTRIBUTOR_EXTENSION_POINT, |
271 _validateOccurrencesContributorExtension); | 254 _validateOccurrencesContributorExtension); |
272 } | 255 } |
273 | 256 |
274 @override | 257 @override |
275 void registerExtensions(RegisterExtension registerExtension) { | 258 void registerExtensions(RegisterExtension registerExtension) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 (AnalysisServer server) => new CompletionDomainHandler(server)); | 299 (AnalysisServer server) => new CompletionDomainHandler(server)); |
317 registerExtension(domainId, | 300 registerExtension(domainId, |
318 (AnalysisServer server) => new ExecutionDomainHandler(server)); | 301 (AnalysisServer server) => new ExecutionDomainHandler(server)); |
319 registerExtension(domainId, | 302 registerExtension(domainId, |
320 (AnalysisServer server) => new DiagnosticDomainHandler(server)); | 303 (AnalysisServer server) => new DiagnosticDomainHandler(server)); |
321 // | 304 // |
322 // Register fix contributors. | 305 // Register fix contributors. |
323 // | 306 // |
324 registerExtension( | 307 registerExtension( |
325 FIX_CONTRIBUTOR_EXTENSION_POINT_ID, new DefaultFixContributor()); | 308 FIX_CONTRIBUTOR_EXTENSION_POINT_ID, new DefaultFixContributor()); |
326 // | |
327 // Register index contributors. | |
328 // | |
329 registerExtension( | |
330 INDEX_CONTRIBUTOR_EXTENSION_POINT_ID, new DartIndexContributor()); | |
331 } | 309 } |
332 | 310 |
333 /** | 311 /** |
334 * Return `true` if the list being used as an [extension] contains any | 312 * Return `true` if the list being used as an [extension] contains any |
335 * elements that are not strings. | 313 * elements that are not strings. |
336 */ | 314 */ |
337 bool _containsNonString(List extension) { | 315 bool _containsNonString(List extension) { |
338 for (Object element in extension) { | 316 for (Object element in extension) { |
339 if (element is! String) { | 317 if (element is! String) { |
340 return true; | 318 return true; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
396 */ | 374 */ |
397 void _validateFixContributorExtension(Object extension) { | 375 void _validateFixContributorExtension(Object extension) { |
398 if (extension is! FixContributor) { | 376 if (extension is! FixContributor) { |
399 String id = fixContributorExtensionPoint.uniqueIdentifier; | 377 String id = fixContributorExtensionPoint.uniqueIdentifier; |
400 throw new ExtensionError('Extensions to $id must be a FixContributor'); | 378 throw new ExtensionError('Extensions to $id must be a FixContributor'); |
401 } | 379 } |
402 } | 380 } |
403 | 381 |
404 /** | 382 /** |
405 * Validate the given extension by throwing an [ExtensionError] if it is not a | 383 * Validate the given extension by throwing an [ExtensionError] if it is not a |
406 * valid index contributor. | |
407 */ | |
408 void _validateIndexContributorExtension(Object extension) { | |
409 if (extension is! IndexContributor) { | |
410 String id = indexContributorExtensionPoint.uniqueIdentifier; | |
411 throw new ExtensionError('Extensions to $id must be an IndexContributor'); | |
412 } | |
413 } | |
414 | |
415 /** | |
416 * Validate the given extension by throwing an [ExtensionError] if it is not a | |
417 * valid navigation contributor. | 384 * valid navigation contributor. |
418 */ | 385 */ |
419 void _validateNavigationContributorExtension(Object extension) { | 386 void _validateNavigationContributorExtension(Object extension) { |
420 if (extension is! NavigationContributor) { | 387 if (extension is! NavigationContributor) { |
421 String id = navigationContributorExtensionPoint.uniqueIdentifier; | 388 String id = navigationContributorExtensionPoint.uniqueIdentifier; |
422 throw new ExtensionError( | 389 throw new ExtensionError( |
423 'Extensions to $id must be an NavigationContributor'); | 390 'Extensions to $id must be an NavigationContributor'); |
424 } | 391 } |
425 } | 392 } |
426 | 393 |
(...skipping 14 matching lines...) Expand all Loading... | |
441 * valid analysis domain receiver. | 408 * valid analysis domain receiver. |
442 */ | 409 */ |
443 void _validateSetAnalysisDomainFunction(Object extension) { | 410 void _validateSetAnalysisDomainFunction(Object extension) { |
444 if (extension is! SetAnalysisDomain) { | 411 if (extension is! SetAnalysisDomain) { |
445 String id = setAnalysisDomainExtensionPoint.uniqueIdentifier; | 412 String id = setAnalysisDomainExtensionPoint.uniqueIdentifier; |
446 throw new ExtensionError( | 413 throw new ExtensionError( |
447 'Extensions to $id must be a SetAnalysisDomain function'); | 414 'Extensions to $id must be a SetAnalysisDomain function'); |
448 } | 415 } |
449 } | 416 } |
450 } | 417 } |
OLD | NEW |