OLD | NEW |
1 # Providing Quick Assists | 1 # Providing Quick Assists |
2 | 2 |
3 A quick assist is used by clients to provide a set of possible changes to code | 3 A quick assist is used by clients to provide a set of possible changes to code |
4 that are based on the structure of the code. Quick assists are intended to help | 4 that are based on the structure of the code. Quick assists are intended to help |
5 users safely make local changes to code when those changes do not require any | 5 users safely make local changes to code when those changes do not require any |
6 user interaction. (Modifications that require interaction with users or that | 6 user interaction. (Modifications that require interaction with users or that |
7 touch multiple files are usually implemented as refactorings.) | 7 touch multiple files are usually implemented as refactorings.) |
8 | 8 |
9 For example, if the user has a function whose body consists of a single return | 9 For example, if the user has a function whose body consists of a single return |
10 statement in a block, server will provide an assist to convert the function body | 10 statement in a block, server will provide an assist to convert the function body |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ``` | 89 ``` |
90 | 90 |
91 Given a contributor like the one above, you can implement your plugin similar to | 91 Given a contributor like the one above, you can implement your plugin similar to |
92 the following: | 92 the following: |
93 | 93 |
94 ```dart | 94 ```dart |
95 class MyPlugin extends ServerPlugin with AssistsMixin, DartAssistsMixin { | 95 class MyPlugin extends ServerPlugin with AssistsMixin, DartAssistsMixin { |
96 // ... | 96 // ... |
97 | 97 |
98 @override | 98 @override |
99 List<AssistContributor> getAssistContributors( | 99 List<AssistContributor> getAssistContributors(AnalysisDriver driver) { |
100 covariant AnalysisDriver driver) { | |
101 return <AssistContributor>[new MyAssistContributor()]; | 100 return <AssistContributor>[new MyAssistContributor()]; |
102 } | 101 } |
103 } | 102 } |
104 ``` | 103 ``` |
105 | 104 |
106 [creatingEdits]: creating_edits.md | 105 [creatingEdits]: creating_edits.md |
OLD | NEW |