| 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 /** | 5 /** |
| 6 * Support for client code that extends the analysis server by adding new code | 6 * Support for client code that extends the analysis server by adding new |
| 7 * Dart specific completion contributors. | 7 * Dart specific completion contributors. |
| 8 * | 8 * |
| 9 * Plugins can register Dart specific completion contributor factories. | 9 * Plugins can register Dart specific completion contributor factories. |
| 10 * The registered contributor factoriess will be used to instantiate new | 10 * The registered contributor factories will be used to instantiate new |
| 11 * contributors to get completions any time a client issues | 11 * contributors to get completions any time a client issues |
| 12 * a 'completion.getSuggestions' request. | 12 * a 'completion.getSuggestions' request. |
| 13 * | 13 * |
| 14 * If a plugin wants to add completions, it should implement the class | 14 * If a plugin wants to add completions, it should implement |
| 15 * [DartCompletionContributorFactory] and then register the contributor | 15 * [DartCompletionContributorFactory] by including code |
| 16 * by including code like the following in the plugin's | 16 * like the following in the plugin's registerExtensions method: |
| 17 * registerExtensions method: | |
| 18 * | 17 * |
| 19 * @override | 18 * @override |
| 20 * void registerExtensions(RegisterExtension registerExtension) { | 19 * void registerExtensions(RegisterExtension registerExtension) { |
| 21 * ... | 20 * ... |
| 22 * registerExtension( | 21 * registerExtension( |
| 23 * DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID, | 22 * DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID, |
| 24 * () => [new MyDartCompletionContributor()]); | 23 * () => new MyDartCompletionContributor()); |
| 25 * ... | 24 * ... |
| 26 * } | 25 * } |
| 27 */ | 26 */ |
| 28 library analysis_server.src.provisional.completion.completion; | 27 library analysis_server.src.provisional.completion.completion; |
| 29 | 28 |
| 30 import 'package:analysis_server/src/plugin/server_plugin.dart'; | |
| 31 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 29 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
| 30 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi
n.dart'; |
| 32 import 'package:plugin/plugin.dart'; | 31 import 'package:plugin/plugin.dart'; |
| 33 | 32 |
| 34 /** | 33 /** |
| 35 * The identifier of the extension point that allows plugins to register code | 34 * The identifier of the extension point that allows plugins to register code |
| 36 * completion contributors. The object used as an extension must be a | 35 * completion contributors. The object used as an extension must be a |
| 37 * [DartCompletionContributor]. | 36 * [DartCompletionContributor]. |
| 38 */ | 37 */ |
| 39 final String DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID = Plugin.join( | 38 final String DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID = Plugin.join( |
| 40 ServerPlugin.UNIQUE_IDENTIFIER, | 39 DartCompletionPlugin.UNIQUE_IDENTIFIER, |
| 41 ServerPlugin.DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT); | 40 DartCompletionPlugin.CONTRIBUTOR_EXTENSION_POINT); |
| OLD | NEW |