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.dart.util; | 5 library test.services.completion.dart.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/plugin/protocol/protocol.dart'; | 13 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
14 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 14 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
15 import 'package:analysis_server/src/services/completion/completion_core.dart'; | 15 import 'package:analysis_server/src/services/completion/completion_core.dart'; |
16 import 'package:analysis_server/src/services/completion/completion_performance.d
art'; | 16 import 'package:analysis_server/src/services/completion/completion_performance.d
art'; |
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 show DartCompletionRequestImpl, ReplacementRange; | 18 show DartCompletionRequestImpl, ReplacementRange; |
19 import 'package:analysis_server/src/services/index2/index2.dart'; | 19 import 'package:analysis_server/src/services/index/index.dart'; |
20 import 'package:analysis_server/src/services/search/search_engine_internal2.dart
'; | 20 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; |
21 import 'package:analyzer/src/generated/source.dart'; | 21 import 'package:analyzer/src/generated/source.dart'; |
22 import 'package:analyzer/task/dart.dart'; | 22 import 'package:analyzer/task/dart.dart'; |
23 import 'package:unittest/unittest.dart'; | 23 import 'package:unittest/unittest.dart'; |
24 | 24 |
25 import '../../../abstract_context.dart'; | 25 import '../../../abstract_context.dart'; |
26 | 26 |
27 int suggestionComparator(CompletionSuggestion s1, CompletionSuggestion s2) { | 27 int suggestionComparator(CompletionSuggestion s1, CompletionSuggestion s2) { |
28 String c1 = s1.completion.toLowerCase(); | 28 String c1 = s1.completion.toLowerCase(); |
29 String c2 = s2.completion.toLowerCase(); | 29 String c2 = s2.completion.toLowerCase(); |
30 return c1.compareTo(c2); | 30 return c1.compareTo(c2); |
31 } | 31 } |
32 | 32 |
33 abstract class DartCompletionContributorTest extends AbstractContextTest { | 33 abstract class DartCompletionContributorTest extends AbstractContextTest { |
34 Index2 index; | 34 Index index; |
35 SearchEngineImpl2 searchEngine; | 35 SearchEngineImpl searchEngine; |
36 String testFile = '/completionTest.dart'; | 36 String testFile = '/completionTest.dart'; |
37 Source testSource; | 37 Source testSource; |
38 int completionOffset; | 38 int completionOffset; |
39 int replacementOffset; | 39 int replacementOffset; |
40 int replacementLength; | 40 int replacementLength; |
41 DartCompletionContributor contributor; | 41 DartCompletionContributor contributor; |
42 DartCompletionRequest request; | 42 DartCompletionRequest request; |
43 List<CompletionSuggestion> suggestions; | 43 List<CompletionSuggestion> suggestions; |
44 | 44 |
45 /** | 45 /** |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 | 533 |
534 void resolveSource(String path, String content) { | 534 void resolveSource(String path, String content) { |
535 Source libSource = addSource(path, content); | 535 Source libSource = addSource(path, content); |
536 var target = new LibrarySpecificUnit(libSource, libSource); | 536 var target = new LibrarySpecificUnit(libSource, libSource); |
537 context.computeResult(target, RESOLVED_UNIT); | 537 context.computeResult(target, RESOLVED_UNIT); |
538 } | 538 } |
539 | 539 |
540 @override | 540 @override |
541 void setUp() { | 541 void setUp() { |
542 super.setUp(); | 542 super.setUp(); |
543 index = createMemoryIndex2(); | 543 index = createMemoryIndex(); |
544 searchEngine = new SearchEngineImpl2(index); | 544 searchEngine = new SearchEngineImpl(index); |
545 contributor = createContributor(); | 545 contributor = createContributor(); |
546 } | 546 } |
547 } | 547 } |
OLD | NEW |