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 services.correction.assist; | 5 library services.correction.assist; |
6 | 6 |
7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
8 import 'package:analysis_server/src/services/correction/assist_internal.dart'; | 8 import 'package:analysis_server/src/services/correction/assist_internal.dart'; |
9 import 'package:analysis_server/src/services/search/search_engine.dart'; | |
10 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
11 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
12 | 11 |
13 | 12 |
14 /** | 13 /** |
15 * Computes [Assist]s at the given location. | 14 * Computes [Assist]s at the given location. |
16 * | 15 * |
17 * Returns the computed [Assist]s, not `null`. | 16 * Returns the computed [Assist]s, not `null`. |
18 */ | 17 */ |
19 List<Assist> computeAssists(SearchEngine searchEngine, CompilationUnit unit, | 18 List<Assist> computeAssists(CompilationUnit unit, int offset, int length) { |
20 int offset, int length) { | |
21 Source source = unit.element.source; | 19 Source source = unit.element.source; |
22 String file = source.fullName; | 20 String file = source.fullName; |
23 AssistProcessor processor = | 21 AssistProcessor processor = |
24 new AssistProcessor(searchEngine, source, file, unit, offset, length); | 22 new AssistProcessor(source, file, unit, offset, length); |
25 return processor.compute(); | 23 return processor.compute(); |
26 } | 24 } |
27 | 25 |
28 | 26 |
29 /** | 27 /** |
30 * A description of a single proposed assist. | 28 * A description of a single proposed assist. |
31 */ | 29 */ |
32 class Assist { | 30 class Assist { |
33 final AssistKind kind; | 31 final AssistKind kind; |
34 final SourceChange change; | 32 final SourceChange change; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 121 |
124 final name; | 122 final name; |
125 final int relevance; | 123 final int relevance; |
126 final String message; | 124 final String message; |
127 | 125 |
128 const AssistKind(this.name, this.relevance, this.message); | 126 const AssistKind(this.name, this.relevance, this.message); |
129 | 127 |
130 @override | 128 @override |
131 String toString() => name; | 129 String toString() => name; |
132 } | 130 } |
OLD | NEW |