| 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/src/protocol.dart' as protocol show Element, | 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, |
| 10 ElementKind; | 10 ElementKind; |
| 11 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind; | 11 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind; |
| 12 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; |
| 12 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; | 13 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; |
| 13 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 14 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| 14 import 'package:analysis_server/src/services/completion/imported_computer.dart'; | 15 import 'package:analysis_server/src/services/completion/imported_computer.dart'; |
| 15 import 'package:analysis_server/src/services/completion/invocation_computer.dart
'; | 16 import 'package:analysis_server/src/services/completion/invocation_computer.dart
'; |
| 16 import 'package:analysis_server/src/services/completion/local_computer.dart'; | 17 import 'package:analysis_server/src/services/completion/local_computer.dart'; |
| 17 import 'package:analysis_server/src/services/index/index.dart'; | 18 import 'package:analysis_server/src/services/index/index.dart'; |
| 18 import 'package:analysis_server/src/services/index/local_memory_index.dart'; | 19 import 'package:analysis_server/src/services/index/local_memory_index.dart'; |
| 19 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; | 20 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; |
| 20 import 'package:analyzer/src/generated/ast.dart'; | 21 import 'package:analyzer/src/generated/ast.dart'; |
| 21 import 'package:analyzer/src/generated/element.dart'; | 22 import 'package:analyzer/src/generated/element.dart'; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 expect(nextOffset, equals(-1), reason: 'too many ^'); | 59 expect(nextOffset, equals(-1), reason: 'too many ^'); |
| 59 content = content.substring(0, completionOffset) + | 60 content = content.substring(0, completionOffset) + |
| 60 content.substring(completionOffset + 1); | 61 content.substring(completionOffset + 1); |
| 61 testSource = addSource(testFile, content); | 62 testSource = addSource(testFile, content); |
| 62 cache = new DartCompletionCache(context, testSource); | 63 cache = new DartCompletionCache(context, testSource); |
| 63 request = new DartCompletionRequest( | 64 request = new DartCompletionRequest( |
| 64 context, | 65 context, |
| 65 searchEngine, | 66 searchEngine, |
| 66 testSource, | 67 testSource, |
| 67 completionOffset, | 68 completionOffset, |
| 68 cache); | 69 cache, |
| 70 new CompletionPerformance()); |
| 69 } | 71 } |
| 70 | 72 |
| 71 void assertNoSuggestions({CompletionSuggestionKind kind: null}) { | 73 void assertNoSuggestions({CompletionSuggestionKind kind: null}) { |
| 72 if (kind == null) { | 74 if (kind == null) { |
| 73 if (request.suggestions.length > 0) { | 75 if (request.suggestions.length > 0) { |
| 74 failedCompletion('Expected no suggestions', request.suggestions); | 76 failedCompletion('Expected no suggestions', request.suggestions); |
| 75 } | 77 } |
| 76 return; | 78 return; |
| 77 } | 79 } |
| 78 CompletionSuggestion suggestion = request.suggestions.firstWhere( | 80 CompletionSuggestion suggestion = request.suggestions.firstWhere( |
| (...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 assertNotSuggested('bar2'); | 2057 assertNotSuggested('bar2'); |
| 2056 assertNotSuggested('_B'); | 2058 assertNotSuggested('_B'); |
| 2057 assertSuggestLocalClass('Y'); | 2059 assertSuggestLocalClass('Y'); |
| 2058 assertSuggestLocalClass('C'); | 2060 assertSuggestLocalClass('C'); |
| 2059 assertSuggestLocalVariable('f', null); | 2061 assertSuggestLocalVariable('f', null); |
| 2060 assertNotSuggested('x'); | 2062 assertNotSuggested('x'); |
| 2061 assertNotSuggested('e'); | 2063 assertNotSuggested('e'); |
| 2062 }); | 2064 }); |
| 2063 } | 2065 } |
| 2064 } | 2066 } |
| OLD | NEW |