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/plugin/edit/assist/assist_core.dart'; | 7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; |
8 import 'package:analysis_server/plugin/edit/assist/assist_dart.dart'; | 8 import 'package:analysis_server/plugin/edit/assist/assist_dart.dart'; |
9 import 'package:analysis_server/src/plugin/server_plugin.dart'; | |
10 import 'package:analysis_server/src/services/correction/assist.dart'; | 9 import 'package:analysis_server/src/services/correction/assist.dart'; |
11 import 'package:analysis_server/src/services/correction/assist_internal.dart'; | 10 import 'package:analysis_server/src/services/correction/assist_internal.dart'; |
12 import 'package:analyzer/dart/ast/ast.dart'; | 11 import 'package:analyzer/dart/ast/ast.dart'; |
13 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 12 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
14 import 'package:analyzer/dart/element/element.dart'; | 13 import 'package:analyzer/dart/element/element.dart'; |
15 import 'package:analyzer/file_system/file_system.dart'; | 14 import 'package:analyzer/file_system/file_system.dart'; |
16 import 'package:analyzer/source/package_map_resolver.dart'; | 15 import 'package:analyzer/source/package_map_resolver.dart'; |
17 import 'package:analyzer/src/dart/analysis/ast_provider_driver.dart'; | 16 import 'package:analyzer/src/dart/analysis/ast_provider_driver.dart'; |
18 import 'package:analyzer/src/dart/analysis/driver.dart'; | 17 import 'package:analyzer/src/dart/analysis/driver.dart'; |
19 import 'package:analyzer/src/dart/element/ast_provider.dart'; | 18 import 'package:analyzer/src/dart/element/ast_provider.dart'; |
(...skipping 13 matching lines...) Expand all Loading... |
33 defineReflectiveSuite(() { | 32 defineReflectiveSuite(() { |
34 defineReflectiveTests(AssistProcessorTest); | 33 defineReflectiveTests(AssistProcessorTest); |
35 }); | 34 }); |
36 } | 35 } |
37 | 36 |
38 @reflectiveTest | 37 @reflectiveTest |
39 class AssistProcessorTest extends AbstractSingleUnitTest { | 38 class AssistProcessorTest extends AbstractSingleUnitTest { |
40 int offset; | 39 int offset; |
41 int length; | 40 int length; |
42 | 41 |
43 ServerPlugin plugin; | |
44 Assist assist; | 42 Assist assist; |
45 SourceChange change; | 43 SourceChange change; |
46 String resultCode; | 44 String resultCode; |
47 LinkedEditGroup linkedPositionGroup; | 45 LinkedEditGroup linkedPositionGroup; |
48 | 46 |
49 /** | 47 /** |
50 * Asserts that there is an [Assist] of the given [kind] at [offset] which | 48 * Asserts that there is an [Assist] of the given [kind] at [offset] which |
51 * produces the [expected] code when applied to [testCode]. | 49 * produces the [expected] code when applied to [testCode]. |
52 */ | 50 */ |
53 assertHasAssist(AssistKind kind, String expected) async { | 51 assertHasAssist(AssistKind kind, String expected) async { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 102 } |
105 | 103 |
106 List<LinkedEditSuggestion> expectedSuggestions( | 104 List<LinkedEditSuggestion> expectedSuggestions( |
107 LinkedEditSuggestionKind kind, List<String> values) { | 105 LinkedEditSuggestionKind kind, List<String> values) { |
108 return values.map((value) { | 106 return values.map((value) { |
109 return new LinkedEditSuggestion(value, kind); | 107 return new LinkedEditSuggestion(value, kind); |
110 }).toList(); | 108 }).toList(); |
111 } | 109 } |
112 | 110 |
113 void processRequiredPlugins() { | 111 void processRequiredPlugins() { |
114 plugin = new ServerPlugin(); | |
115 | |
116 List<Plugin> plugins = <Plugin>[]; | 112 List<Plugin> plugins = <Plugin>[]; |
117 plugins.addAll(AnalysisEngine.instance.requiredPlugins); | 113 plugins.addAll(AnalysisEngine.instance.requiredPlugins); |
118 plugins.add(plugin); | |
119 | 114 |
120 ExtensionManager manager = new ExtensionManager(); | 115 ExtensionManager manager = new ExtensionManager(); |
121 manager.processPlugins(plugins); | 116 manager.processPlugins(plugins); |
122 } | 117 } |
123 | 118 |
124 void setUp() { | 119 void setUp() { |
125 super.setUp(); | 120 super.setUp(); |
126 offset = 0; | 121 offset = 0; |
127 length = 0; | 122 length = 0; |
128 } | 123 } |
(...skipping 4272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4401 | 4396 |
4402 @override | 4397 @override |
4403 final AstProvider astProvider; | 4398 final AstProvider astProvider; |
4404 | 4399 |
4405 @override | 4400 @override |
4406 final CompilationUnit unit; | 4401 final CompilationUnit unit; |
4407 | 4402 |
4408 _DartAssistContextForValues(this.source, this.selectionOffset, | 4403 _DartAssistContextForValues(this.source, this.selectionOffset, |
4409 this.selectionLength, this.analysisDriver, this.astProvider, this.unit); | 4404 this.selectionLength, this.analysisDriver, this.astProvider, this.unit); |
4410 } | 4405 } |
OLD | NEW |