| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * Support for client code that interacts with the analysis domain of an | |
| 7 * analysis server. | |
| 8 * | |
| 9 * Plugins can gain access to the request handler that implements the analysis | |
| 10 * domain in order to extend the functionality of that domain. The class | |
| 11 * [AnalysisDomain] defines the API of the analysis domain that plugins can use. | |
| 12 * | |
| 13 * If a plugin is interested in gaining access to the analysis domain, it should | |
| 14 * register a function by including code like the following in the plugin's | |
| 15 * registerExtensions method: | |
| 16 * | |
| 17 * AnalysisDomain analysisDomain; | |
| 18 * | |
| 19 * @override | |
| 20 * void registerExtensions(RegisterExtension registerExtension) { | |
| 21 * ... | |
| 22 * registerExtension( | |
| 23 * SET_ANALYSIS_DOMAIN_EXTENSION_POINT_ID, | |
| 24 * (AnalysisDomain domain) => analysisDomain = domain); | |
| 25 * ... | |
| 26 * } | |
| 27 */ | |
| 28 library analysis_server.analysis; | |
| 29 | |
| 30 import 'dart:async'; | |
| 31 | |
| 32 import 'package:analysis_server/src/plugin/server_plugin.dart'; | |
| 33 import 'package:analysis_server/src/protocol.dart' show AnalysisService; | |
| 34 import 'package:analyzer/src/generated/engine.dart' | |
| 35 show AnalysisContext, ComputedResult; | |
| 36 import 'package:analyzer/src/generated/source.dart' show Source; | |
| 37 import 'package:analyzer/task/model.dart' show ResultDescriptor; | |
| 38 import 'package:plugin/plugin.dart'; | |
| 39 | |
| 40 /** | |
| 41 * The identifier of the extension point that allows plugins to get access to an | |
| 42 * [AnalysisDomain]. The object used as an extension must be a | |
| 43 * [SetAnalysisDomain]. | |
| 44 */ | |
| 45 final String SET_ANALYSIS_DOMAIN_EXTENSION_POINT_ID = Plugin.join( | |
| 46 ServerPlugin.UNIQUE_IDENTIFIER, | |
| 47 ServerPlugin.SET_ANALISYS_DOMAIN_EXTENSION_POINT); | |
| 48 | |
| 49 /** | |
| 50 * A function that is invoked after the analysis domain has been created and is | |
| 51 * initialized. | |
| 52 */ | |
| 53 typedef void SetAnalysisDomain(AnalysisDomain domain); | |
| 54 | |
| 55 /** | |
| 56 * An object that gives plugins access to the analysis domain of the analysis | |
| 57 * server. | |
| 58 * | |
| 59 * Clients are not expected to subtype this class. | |
| 60 */ | |
| 61 abstract class AnalysisDomain { | |
| 62 /** | |
| 63 * Return the stream that is notified when a new value for the given | |
| 64 * [result] is computed. | |
| 65 * | |
| 66 * This method should be used by plugins that need to perform some additional | |
| 67 * processing after analysis has completed. One example would be a plugin that | |
| 68 * needed to send a notification to the client because some data was now | |
| 69 * invalidated. | |
| 70 */ | |
| 71 Stream<ComputedResult> onResultComputed(ResultDescriptor result); | |
| 72 | |
| 73 /** | |
| 74 * Schedule sending the given [service] notifications for the given [source] | |
| 75 * in the given [context]. | |
| 76 */ | |
| 77 void scheduleNotification( | |
| 78 AnalysisContext context, Source source, AnalysisService service); | |
| 79 } | |
| OLD | NEW |