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

Side by Side Diff: pkg/analyzer_plugin/lib/utilities/assist/assist_contributor_mixin.dart

Issue 2956353002: Add a mixin for assists similar to that for fixes (Closed)
Patch Set: Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer_plugin/lib/utilities/assist/assist.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:analyzer/src/generated/java_core.dart';
6 import 'package:analyzer_plugin/protocol/protocol_common.dart';
7 import 'package:analyzer_plugin/protocol/protocol_generated.dart';
8 import 'package:analyzer_plugin/utilities/assist/assist.dart';
9 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar t';
10
11 /**
12 * A partial implementation of an [AssistContributor] that provides a utility
13 * method to make it easier to add assists.
14 *
15 * Clients may not extend or implement this class, but are allowed to use it as
16 * a mix-in when creating a subclass of [AssistContributor].
17 */
18 abstract class AssistContributorMixin implements AssistContributor {
19 /**
20 * The collector to which assists should be added.
21 */
22 AssistCollector get collector;
23
24 /**
25 * Add an assist. Use the [kind] of the assist to get the message and priority ,
26 * and use the change [builder] to get the edits that comprise the assist. If
27 * the message has parameters, then use the list of [args] to populate the
28 * message.
29 */
30 void addAssistFromBuilder(ChangeBuilder builder, AssistKind kind,
31 {List args: null}) {
scheglov 2017/06/28 18:36:33 `null` is the default default value.
Brian Wilkerson 2017/06/28 18:43:49 Removed
32 SourceChange change = builder.sourceChange;
33 if (change.edits.isEmpty) {
34 return;
35 }
36 change.message = formatList(kind.message, args);
37 collector.addAssist(
38 new PrioritizedSourceChange(kind.priority, builder.sourceChange));
39 }
40 }
OLDNEW
« no previous file with comments | « pkg/analyzer_plugin/lib/utilities/assist/assist.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698