aws / aws-toolkit-vscode

Amazon Q, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode
Apache License 2.0
1.51k stars 436 forks source link

feat(codewhisperer): neighborfiles for new context fetching strategy #5582

Closed Will-ShaoHua closed 1 month ago

Will-ShaoHua commented 2 months ago

Problem

Q science team proposed a new crossfile context fetching approach which will utilize "neighborfiles" of the file where users trigger generateCompletion

Definition


/**
 *     1. A: root/util/context/a.ts
 *     2. B: root/util/b.ts
 *     3. C: root/util/service/c.ts
 *     4. D: root/d.ts
 *     5. E: root/util/context/e.ts
 *     6. F: root/util/foo/bar/baz/f.ts
 *
 *   neighborfiles(A) = [B, E]
 *   neighborfiles(B) = [A, C, D, E]
 *   neighborfiles(C) = [B,]
 *   neighborfiles(D) = [B,]
 *   neighborfiles(E) = [A, B]
 *   neighborfiles(F) = []
 *
 *  number values denote file distance between the 2 files
 *       A B C D E F
 *   A  x 1 2 2 0 4
 *   B  1 x 1 1 1 3
 *   C  2 1 x 2 2 4
 *   D  2 1 2 x 2 4
 *   E  0 1 2 2 x 4
 *   F  4 3 4 4 4 x
 */

Solution


License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

justinmk3 commented 1 month ago
Will-ShaoHua commented 1 month ago

please use a valid PR title (check the failing CI job) Is there a user-facing improvement we can mention in the changelog? E.g. "Q context now has improved context based on nearby, related files."

ack, since it's targeting to a feature branch and I think we will do changelog once everything is ready (there should be more PRs coming against this feature branch)