Skip to content

Commit 67c62af

Browse files
author
Zelin Zhou
committed
Merge branch 'master' into feature/stepfunctions-execution
2 parents afeb812 + 2accbd5 commit 67c62af

File tree

14 files changed

+10729
-24
lines changed

14 files changed

+10729
-24
lines changed

.github/workflows/setup-release-candidate.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131
run: |
3232
echo "BRANCH_NAME=release/rc-$(date +%Y%m%d)" >> $GITHUB_OUTPUT
3333
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Generate license attribution
38+
run: npm run scan-licenses
39+
3440
- name: Create RC Branch
3541
env:
3642
BRANCH_NAME: ${{ steps.branch-name.outputs.BRANCH_NAME }}
@@ -41,5 +47,9 @@ jobs:
4147
# Create RC branch from specified commit
4248
git checkout -b $BRANCH_NAME
4349
50+
# Add generated license files
51+
git add LICENSE-THIRD-PARTY
52+
git commit -m "Update third-party license attribution for $BRANCH_NAME"
53+
4454
# Push RC branch
4555
git push origin $BRANCH_NAME

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ packages/*/resources/css/icons.css
5757

5858
# Created by `npm run webRun` when testing extension in web mode
5959
.vscode-test-web
60+
61+
# License scanning output
62+
licenses-full.json

LICENSE-THIRD-PARTY

Lines changed: 10428 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,22 @@ We want your feedback!
5656
- [File an issue](https://github.com/aws/aws-toolkit-vscode/issues/new?labels=bug&template=bug_report.md)
5757
- Or [send a pull request](CONTRIBUTING.md)!
5858

59+
## License Scanning
60+
61+
To generate license reports and attribution documents for third-party dependencies:
62+
63+
```bash
64+
npm run scan-licenses
65+
66+
# Or run directly
67+
./scripts/scan-licenses.sh
68+
```
69+
70+
This generates:
71+
72+
- `LICENSE-THIRD-PARTY` - Attribution document for distribution
73+
- `licenses-full.json` - Complete license data
74+
5975
## License
6076

6177
This project and the subprojects within **(AWS Toolkit for Visual Studio Code, Amazon Q for Visual Studio Code)** is distributed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"reset": "npm run clean && ts-node ./scripts/clean.ts node_modules && npm install",
3939
"generateNonCodeFiles": "npm run generateNonCodeFiles -w packages/ --if-present",
4040
"mergeReports": "ts-node ./scripts/mergeReports.ts",
41-
"skippedTestReport": "ts-node ./scripts/skippedTestReport.ts ./packages/amazonq/test/e2e/"
41+
"skippedTestReport": "ts-node ./scripts/skippedTestReport.ts ./packages/amazonq/test/e2e/",
42+
"scan-licenses": "ts-node ./scripts/scan-licenses.ts"
4243
},
4344
"devDependencies": {
4445
"@aws-toolkits/telemetry": "^1.0.329",

packages/amazonq/src/app/inline/EditRendering/displayImage.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,11 @@ export class EditDecorationManager {
136136
newCode: string,
137137
originalCodeHighlightRanges: Array<{ line: number; start: number; end: number }>
138138
): Promise<void> {
139-
await this.clearDecorations(editor)
140-
141-
await setContext('aws.amazonq.editSuggestionActive' as any, true)
142-
EditSuggestionState.setEditSuggestionActive(true)
139+
// Clear old decorations but don't reset state (state is already set in displaySvgDecoration)
140+
editor.setDecorations(this.imageDecorationType, [])
141+
editor.setDecorations(this.removedCodeDecorationType, [])
142+
this.currentImageDecoration = undefined
143+
this.currentRemovedCodeDecorations = []
143144

144145
this.acceptHandler = onAccept
145146
this.rejectHandler = onReject
@@ -313,8 +314,16 @@ export async function displaySvgDecoration(
313314
) {
314315
const originalCode = editor.document.getText()
315316

317+
// Set edit state immediately to prevent race condition with completion requests
318+
await setContext('aws.amazonq.editSuggestionActive' as any, true)
319+
EditSuggestionState.setEditSuggestionActive(true)
320+
316321
// Check if a completion suggestion is currently active - if so, discard edit suggestion
317322
if (inlineCompletionProvider && (await inlineCompletionProvider.isCompletionActive())) {
323+
// Clean up state since we're not showing the edit
324+
await setContext('aws.amazonq.editSuggestionActive' as any, false)
325+
EditSuggestionState.setEditSuggestionActive(false)
326+
318327
// Emit DISCARD telemetry for edit suggestion that can't be shown due to active completion
319328
const params = createDiscardTelemetryParams(session, item)
320329
languageClient.sendNotification('aws/logInlineCompletionSessionResults', params)
@@ -326,6 +335,10 @@ export async function displaySvgDecoration(
326335

327336
const isPatchValid = applyPatch(editor.document.getText(), item.insertText as string)
328337
if (!isPatchValid) {
338+
// Clean up state since we're not showing the edit
339+
await setContext('aws.amazonq.editSuggestionActive' as any, false)
340+
EditSuggestionState.setEditSuggestionActive(false)
341+
329342
const params = createDiscardTelemetryParams(session, item)
330343
// TODO: this session is closed on flare side hence discarded is not emitted in flare
331344
languageClient.sendNotification('aws/logInlineCompletionSessionResults', params)

packages/amazonq/src/app/inline/recommendationService.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export class RecommendationService {
145145
* Completions use PartialResultToken with single 1 call of [getAllRecommendations].
146146
* Edits leverage partialResultToken to achieve EditStreak such that clients can pull all continuous suggestions generated by the model within 1 EOS block.
147147
*/
148-
if (!isTriggerByDeletion && !request.partialResultToken) {
148+
if (!isTriggerByDeletion && !request.partialResultToken && !EditSuggestionState.isEditSuggestionActive()) {
149149
const completionPromise: Promise<InlineCompletionListWithReferences> = languageClient.sendRequest(
150150
inlineCompletionWithReferencesRequestType.method,
151151
request,
@@ -196,6 +196,9 @@ export class RecommendationService {
196196
})
197197

198198
if (result.items.length > 0 && result.items[0].isInlineEdit === false) {
199+
if (isTriggerByDeletion) {
200+
return []
201+
}
199202
// Completion will not be rendered if an edit suggestion has been active for longer than 1 second
200203
if (EditSuggestionState.isEditSuggestionDisplayingOverOneSecond()) {
201204
const session = this.sessionManager.getActiveSession()

packages/amazonq/test/unit/amazonq/apps/inline/recommendationService.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ describe('RecommendationService', () => {
333333
}
334334
})
335335

336-
it('should make completion request when edit suggestion is active', async () => {
336+
it('should not make completion request when edit suggestion is active', async () => {
337337
// Mock EditSuggestionState to return true (edit suggestion is active)
338338
sandbox.stub(EditSuggestionState, 'isEditSuggestionActive').returns(true)
339339

@@ -360,13 +360,15 @@ describe('RecommendationService', () => {
360360
const completionCalls = cs.filter((c) => c.firstArg === completionApi)
361361
const editCalls = cs.filter((c) => c.firstArg === editApi)
362362

363-
assert.strictEqual(cs.length, 2) // Only edit call
364-
assert.strictEqual(completionCalls.length, 1) // No completion calls
363+
assert.strictEqual(cs.length, 1) // Only edit call
364+
assert.strictEqual(completionCalls.length, 0) // No completion calls
365365
assert.strictEqual(editCalls.length, 1) // One edit call
366366
})
367367

368368
it('should make completion request when edit suggestion is not active', async () => {
369369
// Mock EditSuggestionState to return false (no edit suggestion active)
370+
sandbox.stub(EditSuggestionState, 'isEditSuggestionActive').returns(false)
371+
370372
const mockResult = {
371373
sessionId: 'test-session',
372374
items: [mockInlineCompletionItemOne],

packages/core/src/amazonqGumby/chat/controller/controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,11 +580,11 @@ export class GumbyController {
580580
return
581581
}
582582
const fileContents = await fs.readFileText(fileUri[0].fsPath)
583-
const missingKey = await validateCustomVersionsFile(fileContents)
583+
const errorMessage = validateCustomVersionsFile(fileContents)
584584

585-
if (missingKey) {
585+
if (errorMessage) {
586586
this.messenger.sendMessage(
587-
CodeWhispererConstants.invalidCustomVersionsFileMessage(missingKey),
587+
CodeWhispererConstants.invalidCustomVersionsFileMessage(errorMessage),
588588
message.tabID,
589589
'ai-prompt'
590590
)

packages/core/src/codewhisperer/models/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,8 @@ export const invalidMetadataFileUnsupportedSourceDB =
588588
export const invalidMetadataFileUnsupportedTargetDB =
589589
'I can only convert SQL for migrations to Aurora PostgreSQL or Amazon RDS for PostgreSQL target databases. The provided .sct file indicates another target database for this migration.'
590590

591-
export const invalidCustomVersionsFileMessage = (missingKey: string) =>
592-
`The dependency upgrade file provided is missing required field \`${missingKey}\`. Check that it is configured properly and try again. For an example of the required dependency upgrade file format, see the [documentation](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/code-transformation.html#dependency-upgrade-file).`
591+
export const invalidCustomVersionsFileMessage = (errorMessage: string) =>
592+
`The dependency upgrade file provided is malformed: ${errorMessage}. Check that it is configured properly and try again. For an example of the required dependency upgrade file format, see the [documentation](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/code-transformation.html#dependency-upgrade-file).`
593593

594594
export const invalidMetadataFileErrorParsing =
595595
"It looks like the .sct file you provided isn't valid. Make sure that you've uploaded the .zip file you retrieved from your schema conversion in AWS DMS."

0 commit comments

Comments
 (0)