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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 test_inDartDoc2() async { | 481 test_inDartDoc2() async { |
482 addTestFile(''' | 482 addTestFile(''' |
483 /// Some text^ | 483 /// Some text^ |
484 main(aaa, bbb) {} | 484 main(aaa, bbb) {} |
485 '''); | 485 '''); |
486 await getSuggestions(); | 486 await getSuggestions(); |
487 expect(suggestions, isEmpty); | 487 expect(suggestions, isEmpty); |
488 } | 488 } |
489 | 489 |
490 test_inDartDoc_reference1() async { | 490 test_inDartDoc_reference1() async { |
491 addFile( | 491 addFile('/testA.dart', ''' |
492 '/testA.dart', | |
493 ''' | |
494 part of libA; | 492 part of libA; |
495 foo(bar) => 0;'''); | 493 foo(bar) => 0;'''); |
496 addTestFile(''' | 494 addTestFile(''' |
497 library libA; | 495 library libA; |
498 part "/testA.dart"; | 496 part "/testA.dart"; |
499 import "dart:math"; | 497 import "dart:math"; |
500 /// The [^] | 498 /// The [^] |
501 main(aaa, bbb) {} | 499 main(aaa, bbb) {} |
502 '''); | 500 '''); |
503 await getSuggestions(); | 501 await getSuggestions(); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 '''); | 645 '''); |
648 return getSuggestions().then((_) { | 646 return getSuggestions().then((_) { |
649 expect(replacementOffset, equals(completionOffset)); | 647 expect(replacementOffset, equals(completionOffset)); |
650 expect(replacementLength, equals(0)); | 648 expect(replacementLength, equals(0)); |
651 assertHasResult(CompletionSuggestionKind.INVOCATION, 'm', | 649 assertHasResult(CompletionSuggestionKind.INVOCATION, 'm', |
652 relevance: DART_RELEVANCE_LOCAL_METHOD); | 650 relevance: DART_RELEVANCE_LOCAL_METHOD); |
653 }); | 651 }); |
654 } | 652 } |
655 | 653 |
656 test_partFile() { | 654 test_partFile() { |
657 addFile( | 655 addFile('/project/bin/testA.dart', ''' |
658 '/project/bin/testA.dart', | |
659 ''' | |
660 library libA; | 656 library libA; |
661 part "$testFile"; | 657 part "$testFile"; |
662 import 'dart:html'; | 658 import 'dart:html'; |
663 class A { } | 659 class A { } |
664 '''); | 660 '''); |
665 addTestFile(''' | 661 addTestFile(''' |
666 part of libA; | 662 part of libA; |
667 main() {^}'''); | 663 main() {^}'''); |
668 return getSuggestions().then((_) { | 664 return getSuggestions().then((_) { |
669 expect(replacementOffset, equals(completionOffset)); | 665 expect(replacementOffset, equals(completionOffset)); |
670 expect(replacementLength, equals(0)); | 666 expect(replacementLength, equals(0)); |
671 assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object'); | 667 assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object'); |
672 assertHasResult(CompletionSuggestionKind.INVOCATION, 'HtmlElement'); | 668 assertHasResult(CompletionSuggestionKind.INVOCATION, 'HtmlElement'); |
673 assertHasResult(CompletionSuggestionKind.INVOCATION, 'A'); | 669 assertHasResult(CompletionSuggestionKind.INVOCATION, 'A'); |
674 assertNoResult('test'); | 670 assertNoResult('test'); |
675 }); | 671 }); |
676 } | 672 } |
677 | 673 |
678 test_partFile2() { | 674 test_partFile2() { |
679 addFile( | 675 addFile('/testA.dart', ''' |
680 '/testA.dart', | |
681 ''' | |
682 part of libA; | 676 part of libA; |
683 class A { }'''); | 677 class A { }'''); |
684 addTestFile(''' | 678 addTestFile(''' |
685 library libA; | 679 library libA; |
686 part "/testA.dart"; | 680 part "/testA.dart"; |
687 import 'dart:html'; | 681 import 'dart:html'; |
688 main() {^} | 682 main() {^} |
689 '''); | 683 '''); |
690 return getSuggestions().then((_) { | 684 return getSuggestions().then((_) { |
691 expect(replacementOffset, equals(completionOffset)); | 685 expect(replacementOffset, equals(completionOffset)); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 | 760 |
767 @override | 761 @override |
768 Future sort( | 762 Future sort( |
769 CompletionRequest request, Iterable<CompletionSuggestion> suggestions) { | 763 CompletionRequest request, Iterable<CompletionSuggestion> suggestions) { |
770 if (!enabled) { | 764 if (!enabled) { |
771 throw 'unexpected sort'; | 765 throw 'unexpected sort'; |
772 } | 766 } |
773 return new Future.value(); | 767 return new Future.value(); |
774 } | 768 } |
775 } | 769 } |
OLD | NEW |