Commit 76a1cd0
authored
refactor(amazonq): separate edits from completion code path (aws#7793)
## Problem
related aws/language-servers#2058
Edits as a newly introduced feature, previously the implementation was
living in the same flow as Completion. However the 2 suggestion types
have few different product requirements, thus we decided to completely
separate these 2 suggestions out in terms of their code path.
Key difference
- Language server will process Completion request on receiving request
from IDE clients, and will BLOCK following requests if in-flight request
is not fulfilled yet. Edits, on the other hand, it debounces/delay the
execution time for the sake of "latest" file context to ensure the
suggestion reflects the CORRECT changes users attempt to make.
- Triggering heuristic. For example, Completion is not supposed to be
invoked when users are deleting the code, whereas Edits allow such
scenario to go through.
## Solution
- Introduce a new `onEditCompletion` language server API which is purely
for Edits suggestion.
- Invoke 2 Flare API and serve the response which first arrives (First
come first served).
- Allow Edits suggestion on code deletion
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.1 parent 7ff0659 commit 76a1cd0
File tree
3 files changed
+104
-34
lines changed- packages/amazonq
- src/app/inline
- test/unit/amazonq/apps/inline
3 files changed
+104
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | 279 | | |
286 | 280 | | |
287 | 281 | | |
| |||
370 | 364 | | |
371 | 365 | | |
372 | 366 | | |
373 | | - | |
374 | | - | |
| 367 | + | |
| 368 | + | |
375 | 369 | | |
376 | 370 | | |
377 | 371 | | |
| |||
404 | 398 | | |
405 | 399 | | |
406 | 400 | | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
415 | 412 | | |
416 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
417 | 418 | | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | 419 | | |
423 | 420 | | |
424 | 421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
70 | | - | |
| 70 | + | |
| 71 | + | |
71 | 72 | | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| |||
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
122 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
123 | 170 | | |
124 | 171 | | |
125 | 172 | | |
| |||
Lines changed: 35 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
31 | 39 | | |
32 | 40 | | |
33 | 41 | | |
| |||
134 | 142 | | |
135 | 143 | | |
136 | 144 | | |
137 | | - | |
| 145 | + | |
| 146 | + | |
138 | 147 | | |
139 | 148 | | |
140 | 149 | | |
141 | | - | |
142 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
143 | 158 | | |
144 | 159 | | |
145 | 160 | | |
| |||
177 | 192 | | |
178 | 193 | | |
179 | 194 | | |
180 | | - | |
| 195 | + | |
| 196 | + | |
181 | 197 | | |
182 | 198 | | |
183 | 199 | | |
184 | | - | |
185 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
186 | 208 | | |
187 | 209 | | |
188 | 210 | | |
| |||
192 | 214 | | |
193 | 215 | | |
194 | 216 | | |
195 | | - | |
| 217 | + | |
196 | 218 | | |
197 | 219 | | |
198 | 220 | | |
| |||
218 | 240 | | |
219 | 241 | | |
220 | 242 | | |
221 | | - | |
| 243 | + | |
| 244 | + | |
222 | 245 | | |
223 | 246 | | |
224 | 247 | | |
| |||
235 | 258 | | |
236 | 259 | | |
237 | 260 | | |
| 261 | + | |
238 | 262 | | |
239 | 263 | | |
240 | 264 | | |
| |||
254 | 278 | | |
255 | 279 | | |
256 | 280 | | |
257 | | - | |
| 281 | + | |
| 282 | + | |
258 | 283 | | |
259 | 284 | | |
260 | 285 | | |
| |||
286 | 311 | | |
287 | 312 | | |
288 | 313 | | |
| 314 | + | |
289 | 315 | | |
290 | 316 | | |
291 | 317 | | |
| |||
0 commit comments