| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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:analyzer/src/generated/source.dart'; | 7 import 'package:analyzer/src/generated/source.dart'; |
| 8 import 'package:analyzer_plugin/protocol/protocol_common.dart'; | 8 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
| 9 import 'package:analyzer_plugin/src/utilities/change_builder/change_builder_core
.dart'; | 9 import 'package:analyzer_plugin/src/utilities/change_builder/change_builder_core
.dart'; |
| 10 import 'package:meta/meta.dart'; | 10 import 'package:meta/meta.dart'; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 * as suggestions to the group with the given kind. | 63 * as suggestions to the group with the given kind. |
| 64 * | 64 * |
| 65 * Throws an [ArgumentError] if either [kind] or [suggestions] are provided | 65 * Throws an [ArgumentError] if either [kind] or [suggestions] are provided |
| 66 * without the other. | 66 * without the other. |
| 67 */ | 67 */ |
| 68 void addSimpleLinkedEdit(String groupName, String text, | 68 void addSimpleLinkedEdit(String groupName, String text, |
| 69 {LinkedEditSuggestionKind kind, List<String> suggestions}); | 69 {LinkedEditSuggestionKind kind, List<String> suggestions}); |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * Set the selection to the given location within the edit being built. | 72 * Set the selection to the given location within the edit being built. |
| 73 * |
| 74 * This method only works correctly if all of the edits that will applied to |
| 75 * text before the current edit have already been created. Those edits are |
| 76 * needed in order to convert the current offset (as of the time this method |
| 77 * is invoked) into an offset relative to the text resulting from applying all |
| 78 * of the edits. |
| 73 */ | 79 */ |
| 74 @experimental | |
| 75 void selectHere(); | 80 void selectHere(); |
| 76 | 81 |
| 77 /** | 82 /** |
| 78 * Add the given [string] to the content of the current edit. | 83 * Add the given [string] to the content of the current edit. |
| 79 */ | 84 */ |
| 80 void write(String string); | 85 void write(String string); |
| 81 | 86 |
| 82 /** | 87 /** |
| 83 * Add the given [string] to the content of the current edit and then add an | 88 * Add the given [string] to the content of the current edit and then add an |
| 84 * end-of-line marker. | 89 * end-of-line marker. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 108 * addReplacement(new SourceRange(offset, 0), buildEdit); | 113 * addReplacement(new SourceRange(offset, 0), buildEdit); |
| 109 */ | 114 */ |
| 110 void addInsertion(int offset, void buildEdit(EditBuilder builder)); | 115 void addInsertion(int offset, void buildEdit(EditBuilder builder)); |
| 111 | 116 |
| 112 /** | 117 /** |
| 113 * Add the region of text specified by the given [range] to the linked edit | 118 * Add the region of text specified by the given [range] to the linked edit |
| 114 * group with the given [groupName]. The [range] is relative to the original | 119 * group with the given [groupName]. The [range] is relative to the original |
| 115 * source. This is typically used to include pre-existing regions of text in a | 120 * source. This is typically used to include pre-existing regions of text in a |
| 116 * group. If the region to be included is part of newly generated text, then | 121 * group. If the region to be included is part of newly generated text, then |
| 117 * the method [EditBuilder.addLinkedEdit] should be used instead. | 122 * the method [EditBuilder.addLinkedEdit] should be used instead. |
| 123 * |
| 124 * This method only works correctly if all of the edits that will applied to |
| 125 * text before the given range have already been created. Those edits are |
| 126 * needed in order to convert the range into a range relative to the text |
| 127 * resulting from applying all of the edits. |
| 118 */ | 128 */ |
| 119 void addLinkedPosition(SourceRange range, String groupName); | 129 void addLinkedPosition(SourceRange range, String groupName); |
| 120 | 130 |
| 121 /** | 131 /** |
| 122 * Add a replacement of text specified by the given [range]. The [range] is | 132 * Add a replacement of text specified by the given [range]. The [range] is |
| 123 * relative to the original source. The [buildEdit] function is used to write | 133 * relative to the original source. The [buildEdit] function is used to write |
| 124 * the text that will replace the specified region. | 134 * the text that will replace the specified region. |
| 125 */ | 135 */ |
| 126 void addReplacement(SourceRange range, void buildEdit(EditBuilder builder)); | 136 void addReplacement(SourceRange range, void buildEdit(EditBuilder builder)); |
| 127 | 137 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 * Add the given [string] to the content of the current edit. | 177 * Add the given [string] to the content of the current edit. |
| 168 */ | 178 */ |
| 169 void write(String string); | 179 void write(String string); |
| 170 | 180 |
| 171 /** | 181 /** |
| 172 * Add the given [string] to the content of the current edit and then add an | 182 * Add the given [string] to the content of the current edit and then add an |
| 173 * end-of-line marker. | 183 * end-of-line marker. |
| 174 */ | 184 */ |
| 175 void writeln([String string]); | 185 void writeln([String string]); |
| 176 } | 186 } |
| OLD | NEW |