| 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.services.completion.util; | 5 library test.services.completion.util; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol | 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol |
| 10 show Element, ElementKind; | 10 show Element, ElementKind; |
| 11 import 'package:analysis_server/plugin/protocol/protocol.dart' | 11 import 'package:analysis_server/plugin/protocol/protocol.dart' |
| 12 hide Element, ElementKind; | 12 hide Element, ElementKind; |
| 13 import 'package:analysis_server/src/provisional/completion/dart/completion_targe
t.dart'; | 13 import 'package:analysis_server/src/provisional/completion/dart/completion_targe
t.dart'; |
| 14 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; | 14 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; |
| 15 import 'package:analysis_server/src/services/completion/dart/common_usage_sorter
.dart'; | 15 import 'package:analysis_server/src/services/completion/dart/common_usage_sorter
.dart'; |
| 16 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; | 16 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; |
| 17 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 17 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| 18 import 'package:analysis_server/src/services/completion/imported_reference_contr
ibutor.dart'; | 18 import 'package:analysis_server/src/services/completion/imported_reference_contr
ibutor.dart'; |
| 19 import 'package:analysis_server/src/services/completion/prefixed_element_contrib
utor.dart'; | |
| 20 import 'package:analysis_server/src/services/index/index.dart'; | 19 import 'package:analysis_server/src/services/index/index.dart'; |
| 21 import 'package:analysis_server/src/services/index/local_memory_index.dart'; | 20 import 'package:analysis_server/src/services/index/local_memory_index.dart'; |
| 22 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; | 21 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; |
| 23 import 'package:analyzer/src/generated/ast.dart'; | 22 import 'package:analyzer/src/generated/ast.dart'; |
| 24 import 'package:analyzer/src/generated/element.dart'; | 23 import 'package:analyzer/src/generated/element.dart'; |
| 25 import 'package:analyzer/src/generated/engine.dart'; | 24 import 'package:analyzer/src/generated/engine.dart'; |
| 26 import 'package:analyzer/src/generated/source.dart'; | 25 import 'package:analyzer/src/generated/source.dart'; |
| 27 import 'package:unittest/unittest.dart'; | 26 import 'package:unittest/unittest.dart'; |
| 28 | 27 |
| 29 import '../../abstract_context.dart'; | 28 import '../../abstract_context.dart'; |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 CompletionSuggestion assertSuggestImportedTopLevelVar( | 629 CompletionSuggestion assertSuggestImportedTopLevelVar( |
| 631 String name, String returnType, | 630 String name, String returnType, |
| 632 [int relevance = DART_RELEVANCE_DEFAULT, | 631 [int relevance = DART_RELEVANCE_DEFAULT, |
| 633 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION, | 632 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION, |
| 634 String importUri]) { | 633 String importUri]) { |
| 635 return assertNotSuggested(name); | 634 return assertNotSuggested(name); |
| 636 } | 635 } |
| 637 | 636 |
| 638 CompletionSuggestion assertSuggestInvocationClass(String name, | 637 CompletionSuggestion assertSuggestInvocationClass(String name, |
| 639 [int relevance = DART_RELEVANCE_DEFAULT]) { | 638 [int relevance = DART_RELEVANCE_DEFAULT]) { |
| 640 if (contributor is PrefixedElementContributor) { | 639 return assertNotSuggested(name); |
| 641 return assertSuggestClass(name, relevance: relevance); | |
| 642 } else { | |
| 643 return assertNotSuggested(name); | |
| 644 } | |
| 645 } | 640 } |
| 646 | 641 |
| 647 CompletionSuggestion assertSuggestInvocationField(String name, String type, | 642 CompletionSuggestion assertSuggestInvocationField(String name, String type, |
| 648 {int relevance: DART_RELEVANCE_DEFAULT, bool isDeprecated: false}) { | 643 {int relevance: DART_RELEVANCE_DEFAULT, bool isDeprecated: false}) { |
| 649 return assertNotSuggested(name); | 644 return assertNotSuggested(name); |
| 650 } | 645 } |
| 651 | 646 |
| 652 CompletionSuggestion assertSuggestInvocationGetter( | 647 CompletionSuggestion assertSuggestInvocationGetter( |
| 653 String name, String returnType, | 648 String name, String returnType, |
| 654 {int relevance: DART_RELEVANCE_DEFAULT, bool isDeprecated: false}) { | 649 {int relevance: DART_RELEVANCE_DEFAULT, bool isDeprecated: false}) { |
| 655 if (contributor is PrefixedElementContributor) { | 650 return assertNotSuggested(name); |
| 656 return assertSuggestGetter(name, returnType, | |
| 657 relevance: relevance, isDeprecated: isDeprecated); | |
| 658 } else { | |
| 659 return assertNotSuggested(name); | |
| 660 } | |
| 661 } | 651 } |
| 662 | 652 |
| 663 CompletionSuggestion assertSuggestInvocationMethod( | 653 CompletionSuggestion assertSuggestInvocationMethod( |
| 664 String name, String declaringType, String returnType, | 654 String name, String declaringType, String returnType, |
| 665 {int relevance: DART_RELEVANCE_DEFAULT}) { | 655 {int relevance: DART_RELEVANCE_DEFAULT}) { |
| 666 if (contributor is PrefixedElementContributor) { | 656 return assertNotSuggested(name); |
| 667 return assertSuggestMethod(name, declaringType, returnType, | |
| 668 relevance: relevance); | |
| 669 } else { | |
| 670 return assertNotSuggested(name); | |
| 671 } | |
| 672 } | 657 } |
| 673 | 658 |
| 674 CompletionSuggestion assertSuggestInvocationSetter(String name, | 659 CompletionSuggestion assertSuggestInvocationSetter(String name, |
| 675 [int relevance = DART_RELEVANCE_DEFAULT]) { | 660 [int relevance = DART_RELEVANCE_DEFAULT]) { |
| 676 if (contributor is PrefixedElementContributor) { | 661 return assertNotSuggested(name); |
| 677 return assertSuggestSetter(name); | |
| 678 } else { | |
| 679 return assertNotSuggested(name); | |
| 680 } | |
| 681 } | 662 } |
| 682 | 663 |
| 683 CompletionSuggestion assertSuggestInvocationTopLevelVar( | 664 CompletionSuggestion assertSuggestInvocationTopLevelVar( |
| 684 String name, String returnType, | 665 String name, String returnType, |
| 685 [int relevance = DART_RELEVANCE_DEFAULT]) { | 666 [int relevance = DART_RELEVANCE_DEFAULT]) { |
| 686 if (contributor is PrefixedElementContributor) { | 667 return assertNotSuggested(name); |
| 687 return assertSuggestTopLevelVar(name, returnType, relevance); | |
| 688 } else { | |
| 689 return assertNotSuggested(name); | |
| 690 } | |
| 691 } | 668 } |
| 692 | 669 |
| 693 CompletionSuggestion assertSuggestLocalClass(String name, | 670 CompletionSuggestion assertSuggestLocalClass(String name, |
| 694 {CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION, | 671 {CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION, |
| 695 int relevance: DART_RELEVANCE_DEFAULT, | 672 int relevance: DART_RELEVANCE_DEFAULT, |
| 696 bool isDeprecated: false, | 673 bool isDeprecated: false, |
| 697 String elemFile, | 674 String elemFile, |
| 698 int elemOffset}) { | 675 int elemOffset}) { |
| 699 return assertNotSuggested(name); | 676 return assertNotSuggested(name); |
| 700 } | 677 } |
| (...skipping 3998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4699 assertNotSuggested('bar2'); | 4676 assertNotSuggested('bar2'); |
| 4700 assertNotSuggested('_B'); | 4677 assertNotSuggested('_B'); |
| 4701 assertSuggestLocalClass('Y'); | 4678 assertSuggestLocalClass('Y'); |
| 4702 assertSuggestLocalClass('C'); | 4679 assertSuggestLocalClass('C'); |
| 4703 assertSuggestLocalVariable('f', null); | 4680 assertSuggestLocalVariable('f', null); |
| 4704 assertNotSuggested('x'); | 4681 assertNotSuggested('x'); |
| 4705 assertNotSuggested('e'); | 4682 assertNotSuggested('e'); |
| 4706 }); | 4683 }); |
| 4707 } | 4684 } |
| 4708 } | 4685 } |
| OLD | NEW |