| Index: pkg/analysis_server/lib/src/plugin/server_plugin.dart
|
| diff --git a/pkg/analysis_server/lib/src/plugin/server_plugin.dart b/pkg/analysis_server/lib/src/plugin/server_plugin.dart
|
| index 3d02551cada7fb264b9196ed5c5a526b164a2667..ddec2dca6ebb532ba2cde6843f96be54dca2b5ca 100644
|
| --- a/pkg/analysis_server/lib/src/plugin/server_plugin.dart
|
| +++ b/pkg/analysis_server/lib/src/plugin/server_plugin.dart
|
| @@ -4,9 +4,11 @@
|
|
|
| library analysis_server.src.plugin.server_plugin;
|
|
|
| +import 'package:analysis_server/completion/completion_core.dart';
|
| import 'package:analysis_server/edit/assist/assist_core.dart';
|
| import 'package:analysis_server/edit/fix/fix_core.dart';
|
| import 'package:analysis_server/plugin/assist.dart';
|
| +//import 'package:analysis_server/plugin/completion.dart';
|
| import 'package:analysis_server/plugin/fix.dart';
|
| import 'package:analysis_server/src/analysis_server.dart';
|
| import 'package:analysis_server/src/domain_analysis.dart';
|
| @@ -39,6 +41,13 @@ class ServerPlugin implements Plugin {
|
|
|
| /**
|
| * The simple identifier of the extension point that allows plugins to
|
| + * register new completion contributors with the server.
|
| + */
|
| + static const String COMPLETION_CONTRIBUTOR_EXTENSION_POINT =
|
| + 'completionContributor';
|
| +
|
| + /**
|
| + * The simple identifier of the extension point that allows plugins to
|
| * register new domains with the server.
|
| */
|
| static const String DOMAIN_EXTENSION_POINT = 'domain';
|
| @@ -61,6 +70,12 @@ class ServerPlugin implements Plugin {
|
| ExtensionPoint assistContributorExtensionPoint;
|
|
|
| /**
|
| + * The extension point that allows plugins to register new completion
|
| + * contributors with the server.
|
| + */
|
| + ExtensionPoint completionContributorExtensionPoint;
|
| +
|
| + /**
|
| * The extension point that allows plugins to register new domains with the
|
| * server.
|
| */
|
| @@ -77,15 +92,28 @@ class ServerPlugin implements Plugin {
|
| */
|
| ServerPlugin();
|
|
|
| - @override
|
| - String get uniqueIdentifier => UNIQUE_IDENTIFIER;
|
| + /**
|
| + * Return a list containing all of the assist contributors that were
|
| + * contributed.
|
| + */
|
| + List<AssistContributor> get assistContributors =>
|
| + assistContributorExtensionPoint.extensions;
|
| +
|
| + /**
|
| + * Return a list containing all of the completion contributors that were
|
| + * contributed.
|
| + */
|
| + List<CompletionContributor> get completionContributors =>
|
| + completionContributorExtensionPoint.extensions;
|
|
|
| /**
|
| * Return a list containing all of the fix contributors that were contributed.
|
| */
|
| - List<AssistContributor> assistContributors() {
|
| - return assistContributorExtensionPoint.extensions;
|
| - }
|
| + List<FixContributor> get fixContributors =>
|
| + fixContributorExtensionPoint.extensions;
|
| +
|
| + @override
|
| + String get uniqueIdentifier => UNIQUE_IDENTIFIER;
|
|
|
| /**
|
| * Use the given [server] to create all of the domains ([RequestHandler]'s)
|
| @@ -100,18 +128,14 @@ class ServerPlugin implements Plugin {
|
| .toList();
|
| }
|
|
|
| - /**
|
| - * Return a list containing all of the fix contributors that were contributed.
|
| - */
|
| - List<FixContributor> fixContributors() {
|
| - return fixContributorExtensionPoint.extensions;
|
| - }
|
| -
|
| @override
|
| void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) {
|
| assistContributorExtensionPoint = registerExtensionPoint(
|
| ASSIST_CONTRIBUTOR_EXTENSION_POINT,
|
| _validateAssistContributorExtension);
|
| + completionContributorExtensionPoint = registerExtensionPoint(
|
| + COMPLETION_CONTRIBUTOR_EXTENSION_POINT,
|
| + _validateCompletionContributorExtension);
|
| domainExtensionPoint = registerExtensionPoint(
|
| DOMAIN_EXTENSION_POINT, _validateDomainExtension);
|
| fixContributorExtensionPoint = registerExtensionPoint(
|
| @@ -126,6 +150,12 @@ class ServerPlugin implements Plugin {
|
| registerExtension(
|
| ASSIST_CONTRIBUTOR_EXTENSION_POINT_ID, new DefaultAssistContributor());
|
| //
|
| + // Register completion contributors.
|
| + //
|
| + // TODO(brianwilkerson) Register the completion contributors.
|
| +// registerExtension(
|
| +// COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID, ???);
|
| + //
|
| // Register domains.
|
| //
|
| String domainId = Plugin.join(UNIQUE_IDENTIFIER, DOMAIN_EXTENSION_POINT);
|
| @@ -150,7 +180,7 @@ class ServerPlugin implements Plugin {
|
|
|
| /**
|
| * Validate the given extension by throwing an [ExtensionError] if it is not a
|
| - * valid fix contributor.
|
| + * valid assist contributor.
|
| */
|
| void _validateAssistContributorExtension(Object extension) {
|
| if (extension is! AssistContributor) {
|
| @@ -162,6 +192,18 @@ class ServerPlugin implements Plugin {
|
|
|
| /**
|
| * Validate the given extension by throwing an [ExtensionError] if it is not a
|
| + * valid completion contributor.
|
| + */
|
| + void _validateCompletionContributorExtension(Object extension) {
|
| + if (extension is! CompletionContributor) {
|
| + String id = completionContributorExtensionPoint.uniqueIdentifier;
|
| + throw new ExtensionError(
|
| + 'Extensions to $id must be an CompletionContributor');
|
| + }
|
| + }
|
| +
|
| + /**
|
| + * Validate the given extension by throwing an [ExtensionError] if it is not a
|
| * valid domain.
|
| */
|
| void _validateDomainExtension(Object extension) {
|
|
|