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

Side by Side Diff: pkg/analyzer_plugin/lib/utilities/assist/assist.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
OLDNEW
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 'package:analyzer/dart/analysis/results.dart'; 5 import 'package:analyzer/dart/analysis/results.dart';
6 import 'package:analyzer/file_system/file_system.dart'; 6 import 'package:analyzer/file_system/file_system.dart';
7 import 'package:analyzer_plugin/protocol/protocol.dart'; 7 import 'package:analyzer_plugin/protocol/protocol.dart';
8 import 'package:analyzer_plugin/protocol/protocol_generated.dart'; 8 import 'package:analyzer_plugin/protocol/protocol_generated.dart';
9 import 'package:analyzer_plugin/src/utilities/assist/assist.dart'; 9 import 'package:analyzer_plugin/src/utilities/assist/assist.dart';
10 import 'package:analyzer_plugin/utilities/generator.dart'; 10 import 'package:analyzer_plugin/utilities/generator.dart';
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 false, exception.toString(), stackTrace.toString()) 68 false, exception.toString(), stackTrace.toString())
69 .toNotification()); 69 .toNotification());
70 } 70 }
71 } 71 }
72 EditGetAssistsResult result = new EditGetAssistsResult(collector.assists); 72 EditGetAssistsResult result = new EditGetAssistsResult(collector.assists);
73 return new GeneratorResult(result, notifications); 73 return new GeneratorResult(result, notifications);
74 } 74 }
75 } 75 }
76 76
77 /** 77 /**
78 * A description of a class of assists. Instances are intended to hold the
79 * information that is common across a number of assists and to be shared by
80 * those assists.
81 *
82 * Clients may not extend, implement or mix-in this class.
83 */
84 class AssistKind {
85 /**
86 * The name of this kind of assist, used for debugging.
87 */
88 final String name;
89
90 /**
91 * The priority of this kind of assist for the kind of error being addressed.
92 */
93 final int priority;
94
95 /**
96 * A human-readable description of the changes that will be applied by this
97 * kind of assist. The message can contain parameters, where each parameter is
98 * represented by a zero-based index inside curly braces. For example, the
99 * message `"Create a component named '{0}' in '{1}'"` contains two parameters .
100 */
101 final String message;
102
103 /**
104 * Initialize a newly created kind of assist to have the given [name],
105 * [relevance] and [message].
106 */
107 const AssistKind(this.name, this.priority, this.message);
108
109 @override
110 String toString() => name;
111 }
112
113 /**
78 * The information about a requested set of assists. 114 * The information about a requested set of assists.
79 * 115 *
80 * Clients may not extend, implement or mix-in this class. 116 * Clients may not extend, implement or mix-in this class.
81 */ 117 */
82 abstract class AssistRequest { 118 abstract class AssistRequest {
83 /** 119 /**
84 * Return the length of the selection within the source for which assists are 120 * Return the length of the selection within the source for which assists are
85 * being requested. 121 * being requested.
86 */ 122 */
87 int get length; 123 int get length;
(...skipping 15 matching lines...) Expand all
103 * `.dart` file. 139 * `.dart` file.
104 * 140 *
105 * Clients may not extend, implement or mix-in this class. 141 * Clients may not extend, implement or mix-in this class.
106 */ 142 */
107 abstract class DartAssistRequest implements AssistRequest { 143 abstract class DartAssistRequest implements AssistRequest {
108 /** 144 /**
109 * The analysis result for the file in which the assists are being requested. 145 * The analysis result for the file in which the assists are being requested.
110 */ 146 */
111 ResolveResult get result; 147 ResolveResult get result;
112 } 148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698