| 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 library analysis_server.src.provisional.completion.dart.plugin; | 5 library analysis_server.src.provisional.completion.dart.plugin; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/provisional/completion/completion.dart'; |
| 7 import 'package:analysis_server/src/provisional/completion/dart/completion.dart'
; | 8 import 'package:analysis_server/src/provisional/completion/dart/completion.dart'
; |
| 8 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
| 10 import 'package:analysis_server/src/services/completion/dart/completion_manager.
dart'; |
| 9 import 'package:analysis_server/src/services/completion/dart/keyword_contributor
.dart'; | 11 import 'package:analysis_server/src/services/completion/dart/keyword_contributor
.dart'; |
| 10 import 'package:plugin/plugin.dart'; | 12 import 'package:plugin/plugin.dart'; |
| 11 | 13 |
| 12 /** | 14 /** |
| 13 * The shared dart completion plugin instance. | 15 * The shared dart completion plugin instance. |
| 14 */ | 16 */ |
| 15 final DartCompletionPlugin dartCompletionPlugin = new DartCompletionPlugin(); | 17 final DartCompletionPlugin dartCompletionPlugin = new DartCompletionPlugin(); |
| 16 | 18 |
| 17 class DartCompletionPlugin implements Plugin { | 19 class DartCompletionPlugin implements Plugin { |
| 18 /** | 20 /** |
| (...skipping 27 matching lines...) Expand all Loading... |
| 46 | 48 |
| 47 @override | 49 @override |
| 48 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) { | 50 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) { |
| 49 _contributorExtensionPoint = registerExtensionPoint( | 51 _contributorExtensionPoint = registerExtensionPoint( |
| 50 CONTRIBUTOR_EXTENSION_POINT, | 52 CONTRIBUTOR_EXTENSION_POINT, |
| 51 _validateDartCompletionContributorExtension); | 53 _validateDartCompletionContributorExtension); |
| 52 } | 54 } |
| 53 | 55 |
| 54 @override | 56 @override |
| 55 void registerExtensions(RegisterExtension registerExtension) { | 57 void registerExtensions(RegisterExtension registerExtension) { |
| 58 // |
| 59 // Register DartCompletionManager as a CompletionContributor |
| 60 // which delegates to all the DartCompletionContributors |
| 61 // |
| 62 registerExtension(COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID, |
| 63 () => new DartCompletionManager()); |
| 64 // |
| 65 // Register the default DartCompletionContributors |
| 66 // |
| 56 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID, | 67 registerExtension(DART_COMPLETION_CONTRIBUTOR_EXTENSION_POINT_ID, |
| 57 () => new KeywordContributor()); | 68 () => new KeywordContributor()); |
| 58 } | 69 } |
| 59 | 70 |
| 60 /** | 71 /** |
| 61 * Validate the given extension by throwing an [ExtensionError] if it is not a | 72 * Validate the given extension by throwing an [ExtensionError] if it is not a |
| 62 * valid Dart specific completion contributor. | 73 * valid Dart specific completion contributor. |
| 63 */ | 74 */ |
| 64 void _validateDartCompletionContributorExtension(Object extension) { | 75 void _validateDartCompletionContributorExtension(Object extension) { |
| 65 if (extension is! DartCompletionContributorFactory) { | 76 if (extension is! DartCompletionContributorFactory) { |
| 66 String id = _contributorExtensionPoint.uniqueIdentifier; | 77 String id = _contributorExtensionPoint.uniqueIdentifier; |
| 67 throw new ExtensionError( | 78 throw new ExtensionError( |
| 68 'Extensions to $id must be a DartCompletionContributorFactory'); | 79 'Extensions to $id must be a DartCompletionContributorFactory'); |
| 69 } | 80 } |
| 70 } | 81 } |
| 71 } | 82 } |
| OLD | NEW |