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 | 6 * Support for client code that extends the analysis server by adding new |
7 * occurrences contributors. | 7 * occurrences contributors. |
| 8 * |
| 9 * Plugins can register occurrences contributors. The registered contributors |
| 10 * will be used to get occurrence information any time the server is about to |
| 11 * send an 'analysis.occurrences' notification. |
| 12 * |
| 13 * If a plugin wants to add occurrence information, it should implement the |
| 14 * class [OccurrencesContributor] and then register the contributor by including |
| 15 * code like the following in the plugin's registerExtensions method: |
| 16 * |
| 17 * @override |
| 18 * void registerExtensions(RegisterExtension registerExtension) { |
| 19 * ... |
| 20 * registerExtension( |
| 21 * OCCURRENCES_CONTRIBUTOR_EXTENSION_POINT_ID, |
| 22 * new MyOccurrencesContributor()); |
| 23 * ... |
| 24 * } |
8 */ | 25 */ |
9 library analysis_server.plugin.occurrences; | 26 library analysis_server.plugin.occurrences; |
10 | 27 |
11 import 'package:analysis_server/analysis/occurrences_core.dart'; | 28 import 'package:analysis_server/analysis/occurrences_core.dart'; |
12 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 29 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
13 import 'package:plugin/plugin.dart'; | 30 import 'package:plugin/plugin.dart'; |
14 | 31 |
15 /** | 32 /** |
16 * The identifier of the extension point that allows plugins to register | 33 * The identifier of the extension point that allows plugins to register |
17 * element occurrences. The object used as an extension must be | 34 * occurrence information. The object used as an extension must be an |
18 * a [OccurrencesContributor]. | 35 * [OccurrencesContributor]. |
19 */ | 36 */ |
20 final String OCCURRENCES_CONTRIBUTOR_EXTENSION_POINT_ID = Plugin.join( | 37 final String OCCURRENCES_CONTRIBUTOR_EXTENSION_POINT_ID = Plugin.join( |
21 ServerPlugin.UNIQUE_IDENTIFIER, | 38 ServerPlugin.UNIQUE_IDENTIFIER, |
22 ServerPlugin.OCCURRENCES_CONTRIBUTOR_EXTENSION_POINT); | 39 ServerPlugin.OCCURRENCES_CONTRIBUTOR_EXTENSION_POINT); |
OLD | NEW |