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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
8 import 'package:analysis_server/protocol/protocol_generated.dart'; | 8 import 'package:analysis_server/protocol/protocol_generated.dart'; |
9 import 'package:analysis_server/src/plugin/plugin_manager.dart'; | 9 import 'package:analysis_server/src/plugin/plugin_manager.dart'; |
10 import 'package:analysis_server/src/provisional/completion/completion_core.dart'
; | 10 import 'package:analysis_server/src/provisional/completion/completion_core.dart'
; |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 ^ | 704 ^ |
705 } | 705 } |
706 '''); | 706 '''); |
707 PluginInfo info = new DiscoveredPluginInfo('a', 'b', 'c', null, null); | 707 PluginInfo info = new DiscoveredPluginInfo('a', 'b', 'c', null, null); |
708 plugin.CompletionGetSuggestionsResult result = | 708 plugin.CompletionGetSuggestionsResult result = |
709 new plugin.CompletionGetSuggestionsResult(1, 2, <CompletionSuggestion>[ | 709 new plugin.CompletionGetSuggestionsResult(1, 2, <CompletionSuggestion>[ |
710 new CompletionSuggestion(CompletionSuggestionKind.IDENTIFIER, | 710 new CompletionSuggestion(CompletionSuggestionKind.IDENTIFIER, |
711 DART_RELEVANCE_DEFAULT, 'plugin completion', 3, 0, false, false) | 711 DART_RELEVANCE_DEFAULT, 'plugin completion', 3, 0, false, false) |
712 ]); | 712 ]); |
713 pluginManager.broadcastResults = <PluginInfo, Future<plugin.Response>>{ | 713 pluginManager.broadcastResults = <PluginInfo, Future<plugin.Response>>{ |
714 info: new Future.value(result.toResponse('-')) | 714 info: new Future.value(result.toResponse('-', 1)) |
715 }; | 715 }; |
716 await getSuggestions(); | 716 await getSuggestions(); |
717 assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'plugin completion', | 717 assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'plugin completion', |
718 selectionOffset: 3); | 718 selectionOffset: 3); |
719 } | 719 } |
720 | 720 |
721 test_simple() { | 721 test_simple() { |
722 addTestFile(''' | 722 addTestFile(''' |
723 void main() { | 723 void main() { |
724 ^ | 724 ^ |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 | 766 |
767 @override | 767 @override |
768 Future sort( | 768 Future sort( |
769 CompletionRequest request, Iterable<CompletionSuggestion> suggestions) { | 769 CompletionRequest request, Iterable<CompletionSuggestion> suggestions) { |
770 if (!enabled) { | 770 if (!enabled) { |
771 throw 'unexpected sort'; | 771 throw 'unexpected sort'; |
772 } | 772 } |
773 return new Future.value(); | 773 return new Future.value(); |
774 } | 774 } |
775 } | 775 } |
OLD | NEW |