OLD | NEW |
(Empty) | |
| 1 # Getting Started |
| 2 |
| 3 ## Creating a Minimal Plugin |
| 4 |
| 5 To implement a plugin, start by creating a simple package and create a class |
| 6 that is a subclass of `ServerPlugin`. This class will need to implement a |
| 7 constructor, three getters, and two methods. The getters provide some basic |
| 8 information about your plugin: the name and version, both of which are included |
| 9 in error messages if there is a problem encountered, and a list of glob patterns |
| 10 for the files that the plugin cares about. The methods ... |
| 11 |
| 12 Here's an example of what a minimal plugin might look like. |
| 13 |
| 14 ```dart |
| 15 class MyPlugin extends ServerPlugin { |
| 16 MyPlugin(ResourceProvider provider) : super(provider); |
| 17 |
| 18 @override |
| 19 List<String> get fileGlobsToAnalyze => <String>['**/*.dart']; |
| 20 |
| 21 @override |
| 22 String get name => 'My fantastic plugin'; |
| 23 |
| 24 @override |
| 25 String get version => '1.0.0'; |
| 26 |
| 27 @override |
| 28 AnalysisDriverGeneric createAnalysisDriver(ContextRoot contextRoot) { |
| 29 // TODO: implement createAnalysisDriver |
| 30 return null; |
| 31 } |
| 32 |
| 33 @override |
| 34 void sendNotificationsForSubscriptions( |
| 35 Map<String, List<AnalysisService>> subscriptions) { |
| 36 // TODO: implement sendNotificationsForSubscriptions |
| 37 } |
| 38 } |
| 39 ``` |
OLD | NEW |