Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Side by Side Diff: pkg/analysis_server/lib/src/provisional/completion/dart/completion_plugin.dart

Issue 3001413002: Remove uses of the old plugin model from the analysis server (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 import 'package:analysis_server/src/provisional/completion/completion.dart';
6 import 'package:analysis_server/src/provisional/completion/dart/completion.dart' ;
7 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart';
8 import 'package:analysis_server/src/services/completion/dart/arglist_contributor .dart';
9 import 'package:analysis_server/src/services/completion/dart/combinator_contribu tor.dart';
10 import 'package:analysis_server/src/services/completion/dart/completion_manager. dart';
11 import 'package:analysis_server/src/services/completion/dart/field_formal_contri butor.dart';
12 import 'package:analysis_server/src/services/completion/dart/imported_reference_ contributor.dart';
13 import 'package:analysis_server/src/services/completion/dart/inherited_reference _contributor.dart';
14 import 'package:analysis_server/src/services/completion/dart/keyword_contributor .dart';
15 import 'package:analysis_server/src/services/completion/dart/label_contributor.d art';
16 import 'package:analysis_server/src/services/completion/dart/library_member_cont ributor.dart';
17 import 'package:analysis_server/src/services/completion/dart/library_prefix_cont ributor.dart';
18 import 'package:analysis_server/src/services/completion/dart/local_constructor_c ontributor.dart';
19 import 'package:analysis_server/src/services/completion/dart/local_library_contr ibutor.dart';
20 import 'package:analysis_server/src/services/completion/dart/local_reference_con tributor.dart';
21 import 'package:analysis_server/src/services/completion/dart/named_constructor_c ontributor.dart';
22 import 'package:analysis_server/src/services/completion/dart/static_member_contr ibutor.dart';
23 import 'package:analysis_server/src/services/completion/dart/type_member_contrib utor.dart';
24 import 'package:analysis_server/src/services/completion/dart/uri_contributor.dar t';
25 import 'package:analysis_server/src/services/completion/dart/variable_name_contr ibutor.dart';
26 import 'package:plugin/plugin.dart';
27
28 /**
29 * The shared dart completion plugin instance.
30 */
31 final DartCompletionPlugin dartCompletionPlugin = new DartCompletionPlugin();
32
33 class DartCompletionPlugin implements Plugin {
34 /**
35 * The simple identifier of the extension point that allows plugins to
36 * register Dart specific completion contributor factories.
37 * Use [DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID]
38 * when registering contributors.
39 */
40 static const String CONTRIBUTOR_EXTENSION_POINT = 'contributor';
41
42 /**
43 * The unique identifier of this plugin.
44 */
45 static const String UNIQUE_IDENTIFIER = 'dart.completion';
46
47 /**
48 * The extension point that allows plugins to register Dart specific
49 * completion contributor factories.
50 */
51 ExtensionPoint<DartCompletionContributorFactory> _contributorExtensionPoint;
52
53 /**
54 * Return a list containing all of the Dart specific completion contributors.
55 */
56 Iterable<DartCompletionContributor> get contributors =>
57 _contributorExtensionPoint.extensions.map(
58 (Object factory) => (factory as DartCompletionContributorFactory)());
59
60 @override
61 String get uniqueIdentifier => UNIQUE_IDENTIFIER;
62
63 @override
64 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) {
65 _contributorExtensionPoint =
66 new ExtensionPoint<DartCompletionContributorFactory>(
67 this, CONTRIBUTOR_EXTENSION_POINT, null);
68 registerExtensionPoint(_contributorExtensionPoint);
69 }
70
71 @override
72 void registerExtensions(RegisterExtension registerExtension) {
73 //
74 // Register DartCompletionManager as a CompletionContributor
75 // which delegates to all the DartCompletionContributors
76 //
77 registerExtension(COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
78 () => new DartCompletionManager());
79 //
80 // Register the default DartCompletionContributors
81 //
82 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
83 () => new ArgListContributor());
84 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
85 () => new CombinatorContributor());
86 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
87 () => new FieldFormalContributor());
88 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
89 () => new ImportedReferenceContributor());
90 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
91 () => new InheritedReferenceContributor());
92 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
93 () => new KeywordContributor());
94 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
95 () => new LabelContributor());
96 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
97 () => new LibraryMemberContributor());
98 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
99 () => new LibraryPrefixContributor());
100 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
101 () => new LocalConstructorContributor());
102 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
103 () => new LocalLibraryContributor());
104 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
105 () => new LocalReferenceContributor());
106 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
107 () => new NamedConstructorContributor());
108 // Revisit this contributor and these tests
109 // once DartChangeBuilder API has solidified.
110 // registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
111 // () => new OverrideContributor());
112 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
113 () => new StaticMemberContributor());
114 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
115 () => new TypeMemberContributor());
116 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
117 () => new UriContributor());
118 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID,
119 () => new VariableNameContributor());
120 }
121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698