Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Unified Diff: pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart

Issue 2928723003: Support a short-hand way to create linked edit groups (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
diff --git a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
index f737d028ba0878bb35162d06c6337fad93844a6d..904a7671c44a22778a9207f291fd7eca3ffea747 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
@@ -151,6 +151,22 @@ class EditBuilderImpl implements EditBuilder {
}
}
+ @override
+ void addSimpleLinkedEdit(String groupName, String text,
+ {LinkedEditSuggestionKind kind, List<String> suggestions}) {
+ addLinkedEdit(groupName, (LinkedEditBuilder builder) {
+ builder.write(text);
+ if (suggestions != null && kind != null) {
scheglov 2017/06/07 15:39:11 It would be better to order kind != null && sugges
Brian Wilkerson 2017/06/07 16:07:19 Done
+ for (String suggestion in suggestions) {
+ builder.addSuggestion(kind, suggestion);
+ }
+ } else if (suggestions != null || kind != null) {
+ throw new ArgumentError(
+ 'Either both kind and suggestions must be provided or neither.');
+ }
+ });
+ }
+
LinkedEditBuilderImpl createLinkedEditBuilder() {
return new LinkedEditBuilderImpl(this);
}

Powered by Google App Engine
This is Rietveld 408576698