OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 test.domain.completion; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 | 6 |
9 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
10 import 'package:analysis_server/protocol/protocol_generated.dart'; | 8 import 'package:analysis_server/protocol/protocol_generated.dart'; |
11 import 'package:analysis_server/src/plugin/plugin_manager.dart'; | 9 import 'package:analysis_server/src/plugin/plugin_manager.dart'; |
12 import 'package:analysis_server/src/provisional/completion/completion_core.dart'
; | 10 import 'package:analysis_server/src/provisional/completion/completion_core.dart'
; |
13 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 11 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
14 import 'package:analysis_server/src/services/completion/dart/completion_manager.
dart'; | 12 import 'package:analysis_server/src/services/completion/dart/completion_manager.
dart'; |
15 import 'package:analysis_server/src/services/completion/dart/contribution_sorter
.dart'; | 13 import 'package:analysis_server/src/services/completion/dart/contribution_sorter
.dart'; |
16 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin; | 14 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin; |
17 import 'package:analyzer_plugin/protocol/protocol_common.dart' as plugin; | 15 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
18 import 'package:analyzer_plugin/protocol/protocol_constants.dart' as plugin; | 16 import 'package:analyzer_plugin/protocol/protocol_constants.dart' as plugin; |
19 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; | 17 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; |
20 import 'package:test/test.dart'; | 18 import 'package:test/test.dart'; |
21 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 19 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
22 | 20 |
23 import 'domain_completion_util.dart'; | 21 import 'domain_completion_util.dart'; |
24 import 'mocks.dart' show pumpEventQueue; | 22 import 'mocks.dart' show pumpEventQueue; |
25 | 23 |
26 main() { | 24 main() { |
27 defineReflectiveSuite(() { | 25 defineReflectiveSuite(() { |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 } | 699 } |
702 | 700 |
703 test_sentToPlugins() async { | 701 test_sentToPlugins() async { |
704 addTestFile(''' | 702 addTestFile(''' |
705 void main() { | 703 void main() { |
706 ^ | 704 ^ |
707 } | 705 } |
708 '''); | 706 '''); |
709 PluginInfo info = new DiscoveredPluginInfo('a', 'b', 'c', null, null); | 707 PluginInfo info = new DiscoveredPluginInfo('a', 'b', 'c', null, null); |
710 plugin.CompletionGetSuggestionsResult result = | 708 plugin.CompletionGetSuggestionsResult result = |
711 new plugin.CompletionGetSuggestionsResult( | 709 new plugin.CompletionGetSuggestionsResult(1, 2, <CompletionSuggestion>[ |
712 1, 2, <plugin.CompletionSuggestion>[ | 710 new CompletionSuggestion(CompletionSuggestionKind.IDENTIFIER, |
713 new plugin.CompletionSuggestion( | 711 DART_RELEVANCE_DEFAULT, 'plugin completion', 3, 0, false, false) |
714 plugin.CompletionSuggestionKind.IDENTIFIER, | |
715 DART_RELEVANCE_DEFAULT, | |
716 'plugin completion', | |
717 3, | |
718 0, | |
719 false, | |
720 false) | |
721 ]); | 712 ]); |
722 pluginManager.broadcastResults = <PluginInfo, Future<plugin.Response>>{ | 713 pluginManager.broadcastResults = <PluginInfo, Future<plugin.Response>>{ |
723 info: new Future.value(result.toResponse('-')) | 714 info: new Future.value(result.toResponse('-')) |
724 }; | 715 }; |
725 await getSuggestions(); | 716 await getSuggestions(); |
726 assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'plugin completion', | 717 assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'plugin completion', |
727 selectionOffset: 3); | 718 selectionOffset: 3); |
728 } | 719 } |
729 | 720 |
730 test_simple() { | 721 test_simple() { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 | 766 |
776 @override | 767 @override |
777 Future sort( | 768 Future sort( |
778 CompletionRequest request, Iterable<CompletionSuggestion> suggestions) { | 769 CompletionRequest request, Iterable<CompletionSuggestion> suggestions) { |
779 if (!enabled) { | 770 if (!enabled) { |
780 throw 'unexpected sort'; | 771 throw 'unexpected sort'; |
781 } | 772 } |
782 return new Future.value(); | 773 return new Future.value(); |
783 } | 774 } |
784 } | 775 } |
OLD | NEW |