| 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/analysis_server.dart'; | 13 import 'package:analysis_server/src/analysis_server.dart'; |
| 14 import 'package:analysis_server/src/provisional/completion/dart/completion_targe
t.dart'; | 14 import 'package:analysis_server/src/provisional/completion/dart/completion_targe
t.dart'; |
| 15 import 'package:analysis_server/src/services/completion/common_usage_computer.da
rt'; | |
| 16 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; | 15 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; |
| 16 import 'package:analysis_server/src/services/completion/dart/common_usage_sorter
.dart'; |
| 17 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; | 17 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; |
| 18 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 18 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| 19 import 'package:analysis_server/src/services/completion/imported_reference_contr
ibutor.dart'; | 19 import 'package:analysis_server/src/services/completion/imported_reference_contr
ibutor.dart'; |
| 20 import 'package:analysis_server/src/services/completion/prefixed_element_contrib
utor.dart'; | 20 import 'package:analysis_server/src/services/completion/prefixed_element_contrib
utor.dart'; |
| 21 import 'package:analysis_server/src/services/index/index.dart'; | 21 import 'package:analysis_server/src/services/index/index.dart'; |
| 22 import 'package:analysis_server/src/services/index/local_memory_index.dart'; | 22 import 'package:analysis_server/src/services/index/local_memory_index.dart'; |
| 23 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; | 23 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; |
| 24 import 'package:analyzer/src/generated/ast.dart'; | 24 import 'package:analyzer/src/generated/ast.dart'; |
| 25 import 'package:analyzer/src/generated/element.dart'; | 25 import 'package:analyzer/src/generated/element.dart'; |
| 26 import 'package:analyzer/src/generated/engine.dart'; | 26 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 assertSuggestGetter(name, returnType); | 434 assertSuggestGetter(name, returnType); |
| 435 assertSuggestSetter(name); | 435 assertSuggestSetter(name); |
| 436 } else { | 436 } else { |
| 437 assertNotSuggested(name); | 437 assertNotSuggested(name); |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 | 440 |
| 441 bool computeFast() { | 441 bool computeFast() { |
| 442 expect(computeFastResult, isNull); | 442 expect(computeFastResult, isNull); |
| 443 _completionManager = new DartCompletionManager(context, searchEngine, | 443 _completionManager = new DartCompletionManager(context, searchEngine, |
| 444 testSource, cache, [contributor], new CommonUsageComputer({})); | 444 testSource, cache, [contributor], new CommonUsageSorter({})); |
| 445 var result = | 445 var result = |
| 446 _completionManager.computeFast(request, new CompletionPerformance()); | 446 _completionManager.computeFast(request, new CompletionPerformance()); |
| 447 expect(request.replacementOffset, isNotNull); | 447 expect(request.replacementOffset, isNotNull); |
| 448 expect(request.replacementLength, isNotNull); | 448 expect(request.replacementLength, isNotNull); |
| 449 computeFastResult = result.isEmpty; | 449 computeFastResult = result.isEmpty; |
| 450 return computeFastResult; | 450 return computeFastResult; |
| 451 } | 451 } |
| 452 | 452 |
| 453 Future computeFull(assertFunction(bool result), {bool fullAnalysis: true}) { | 453 Future computeFull(assertFunction(bool result), {bool fullAnalysis: true}) { |
| 454 if (computeFastResult == null) { | 454 if (computeFastResult == null) { |
| (...skipping 4265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4720 assertNotSuggested('bar2'); | 4720 assertNotSuggested('bar2'); |
| 4721 assertNotSuggested('_B'); | 4721 assertNotSuggested('_B'); |
| 4722 assertSuggestLocalClass('Y'); | 4722 assertSuggestLocalClass('Y'); |
| 4723 assertSuggestLocalClass('C'); | 4723 assertSuggestLocalClass('C'); |
| 4724 assertSuggestLocalVariable('f', null); | 4724 assertSuggestLocalVariable('f', null); |
| 4725 assertNotSuggested('x'); | 4725 assertNotSuggested('x'); |
| 4726 assertNotSuggested('e'); | 4726 assertNotSuggested('e'); |
| 4727 }); | 4727 }); |
| 4728 } | 4728 } |
| 4729 } | 4729 } |
| OLD | NEW |