Skip to content

Commit

Permalink
merge master, resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Hweinstock committed Nov 14, 2024
2 parents 7a3b885 + 932ef34 commit 4f46c54
Show file tree
Hide file tree
Showing 129 changed files with 2,226 additions and 788 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/jscpd.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"ignore": ["**node_modules**", "**dist**", "**/scripts/**"],
"gitignore": true,
"threshold": 3.0,
"minLines": 3,
"minLines": 10,
"output": "./",
"reporters": ["json"]
}
25 changes: 15 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"generateNonCodeFiles": "npm run generateNonCodeFiles -w packages/ --if-present"
},
"devDependencies": {
"@aws-toolkits/telemetry": "^1.0.274",
"@aws-toolkits/telemetry": "^1.0.282",
"@playwright/browser-chromium": "^1.43.1",
"@types/he": "^1.2.3",
"@types/vscode": "^1.68.0",
Expand Down
18 changes: 18 additions & 0 deletions packages/amazonq/.changes/1.35.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"date": "2024-11-11",
"version": "1.35.0",
"entries": [
{
"type": "Breaking Change",
"description": "Change focus chat keybind to win+alt+i on Windows, cmd+alt+i on macOS, and meta+alt+i on Linux"
},
{
"type": "Bug Fix",
"description": "Fix suboptimal inline suggestions from Amazon Q caused by improperly formatted supplemental context"
},
{
"type": "Bug Fix",
"description": "Fix empty chunks being sent to service and get validationException"
}
]
}
22 changes: 22 additions & 0 deletions packages/amazonq/.changes/1.36.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"date": "2024-11-14",
"version": "1.36.0",
"entries": [
{
"type": "Bug Fix",
"description": "Fix broken inline suggestion auto-trigger on Systemverfilog files if users dont have systemverilog extension installed and enabled"
},
{
"type": "Bug Fix",
"description": "tutorial always showing on start"
},
{
"type": "Feature",
"description": "Enable default `@workspace` context of Amazon Q chat for certain users"
},
{
"type": "Feature",
"description": "Amazon Q /dev: Add an action to accept individual files"
}
]
}

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 13 additions & 0 deletions packages/amazonq/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 1.36.0 2024-11-14

- **Bug Fix** Fix broken inline suggestion auto-trigger on Systemverfilog files if users dont have systemverilog extension installed and enabled
- **Bug Fix** tutorial always showing on start
- **Feature** Enable default `@workspace` context of Amazon Q chat for certain users
- **Feature** Amazon Q /dev: Add an action to accept individual files

## 1.35.0 2024-11-11

- **Breaking Change** Change focus chat keybind to win+alt+i on Windows, cmd+alt+i on macOS, and meta+alt+i on Linux
- **Bug Fix** Fix suboptimal inline suggestions from Amazon Q caused by improperly formatted supplemental context
- **Bug Fix** Fix empty chunks being sent to service and get validationException

## 1.34.0 2024-11-07

- **Bug Fix** Align example help text with prompt message in chat
Expand Down
2 changes: 1 addition & 1 deletion packages/amazonq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "amazon-q-vscode",
"displayName": "Amazon Q",
"description": "Amazon Q is your generative AI-powered assistant across the software development lifecycle.",
"version": "1.35.0-SNAPSHOT",
"version": "1.37.0-SNAPSHOT",
"extensionKind": [
"workspace"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ export class InlineChatController {
await this.reset()
}

public async updateTaskAndLenses(task: InlineTask, taskState?: TaskState) {
public async updateTaskAndLenses(task?: InlineTask, taskState?: TaskState) {
if (!task) {
return
}
if (taskState) {
task.state = taskState
} else if (!task.diff || task.diff.length === 0) {
Expand Down Expand Up @@ -200,7 +203,7 @@ export class InlineChatController {
this.task = await this.createTask(query, editor.document, editor.selection)
await this.inlineLineAnnotationController.disable(editor)
await this.computeDiffAndRenderOnEditor(query, editor.document).catch(async (err) => {
getLogger().error(err)
getLogger().error('computeDiffAndRenderOnEditor error: %s', (err as Error)?.message)
if (err instanceof Error) {
void vscode.window.showErrorMessage(`Amazon Q: ${err.message}`)
} else {
Expand Down
127 changes: 126 additions & 1 deletion packages/amazonq/test/e2e/amazonq/featureDev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ describe('Amazon Q Feature Dev', function () {
let tab: Messenger

const prompt = 'Add blank.txt file with empty content'
const codegenApproachPrompt = prompt + ' and add a readme that describes the changes'
const codegenApproachPrompt = `${prompt} and add a readme that describes the changes`
const fileLevelAcceptPrompt = `${prompt} and add a license, and a contributing file`
const tooManyRequestsWaitTime = 100000

function waitForButtons(buttons: FollowUpTypes[]) {
Expand Down Expand Up @@ -50,6 +51,14 @@ describe('Amazon Q Feature Dev', function () {
)
}

async function clickActionButton(filePath: string, actionName: string) {
tab.clickFileActionButton(filePath, actionName)
await tab.waitForEvent(() => !tab.hasAction(filePath, actionName), {
waitIntervalInMs: 500,
waitTimeoutInMs: 600000,
})
}

/**
* Wait for the original request to finish.
* If the response has a retry button or encountered a guardrails error, continue retrying
Expand Down Expand Up @@ -216,4 +225,120 @@ describe('Amazon Q Feature Dev', function () {
await waitForButtons([FollowUpTypes.NewTask, FollowUpTypes.CloseSession])
})
})

describe('file-level accepts', async () => {
beforeEach(async function () {
tab.addChatMessage({ command: '/dev', prompt: fileLevelAcceptPrompt })
await retryIfRequired(
async () => {
await tab.waitForChatFinishesLoading()
},
() => {
tab.addChatMessage({ prompt })
}
)
await retryIfRequired(async () => {
await Promise.any([
waitForButtons([FollowUpTypes.InsertCode, FollowUpTypes.ProvideFeedbackAndRegenerateCode]),
waitForButtons([FollowUpTypes.Retry]),
])
})
})

describe('fileList', async () => {
it('has both accept-change and reject-change action buttons for file', async () => {
const filePath = tab.getFilePaths()[0]
assert.ok(tab.getActionsByFilePath(filePath).length === 2)
assert.ok(tab.hasAction(filePath, 'accept-change'))
assert.ok(tab.hasAction(filePath, 'reject-change'))
})

it('has only revert-rejection action button for rejected file', async () => {
const filePath = tab.getFilePaths()[0]
await clickActionButton(filePath, 'reject-change')

assert.ok(tab.getActionsByFilePath(filePath).length === 1)
assert.ok(tab.hasAction(filePath, 'revert-rejection'))
})

it('does not have any of the action buttons for accepted file', async () => {
const filePath = tab.getFilePaths()[0]
await clickActionButton(filePath, 'accept-change')

assert.ok(tab.getActionsByFilePath(filePath).length === 0)
})

it('disables all action buttons when new task is clicked', async () => {
tab.clickButton(FollowUpTypes.InsertCode)
await waitForButtons([FollowUpTypes.NewTask, FollowUpTypes.CloseSession])
tab.clickButton(FollowUpTypes.NewTask)
await waitForText('What new task would you like to work on?')

const filePaths = tab.getFilePaths()
for (const filePath of filePaths) {
assert.ok(tab.getActionsByFilePath(filePath).length === 0)
}
})

it('disables all action buttons when close session is clicked', async () => {
tab.clickButton(FollowUpTypes.InsertCode)
await waitForButtons([FollowUpTypes.NewTask, FollowUpTypes.CloseSession])
tab.clickButton(FollowUpTypes.CloseSession)
await waitForText(
"Okay, I've ended this chat session. You can open a new tab to chat or start another workflow."
)

const filePaths = tab.getFilePaths()
for (const filePath of filePaths) {
assert.ok(tab.getActionsByFilePath(filePath).length === 0)
}
})
})

describe('accept button', async () => {
describe('button text', async () => {
it('shows "Accept all changes" when no files are accepted or rejected, and "Accept remaining changes" otherwise', async () => {
let insertCodeButton = tab.getFollowUpButton(FollowUpTypes.InsertCode)
assert.ok(insertCodeButton.pillText === 'Accept all changes')

const filePath = tab.getFilePaths()[0]
await clickActionButton(filePath, 'reject-change')

insertCodeButton = tab.getFollowUpButton(FollowUpTypes.InsertCode)
assert.ok(insertCodeButton.pillText === 'Accept remaining changes')

await clickActionButton(filePath, 'revert-rejection')

insertCodeButton = tab.getFollowUpButton(FollowUpTypes.InsertCode)
assert.ok(insertCodeButton.pillText === 'Accept all changes')

await clickActionButton(filePath, 'accept-change')

insertCodeButton = tab.getFollowUpButton(FollowUpTypes.InsertCode)
assert.ok(insertCodeButton.pillText === 'Accept remaining changes')
})

it('shows "Continue" when all files are either accepted or rejected, with at least one of them rejected', async () => {
const filePaths = tab.getFilePaths()
for (const filePath of filePaths) {
await clickActionButton(filePath, 'reject-change')
}

const insertCodeButton = tab.getFollowUpButton(FollowUpTypes.InsertCode)
assert.ok(insertCodeButton.pillText === 'Continue')
})
})

it('disappears and automatically moves on to the next step when all changes are accepted', async () => {
const filePaths = tab.getFilePaths()
for (const filePath of filePaths) {
await clickActionButton(filePath, 'accept-change')
}
await waitForButtons([FollowUpTypes.NewTask, FollowUpTypes.CloseSession])

assert.ok(tab.hasButton(FollowUpTypes.InsertCode) === false)
assert.ok(tab.hasButton(FollowUpTypes.ProvideFeedbackAndRegenerateCode) === false)
})
})
})
})
Loading

0 comments on commit 4f46c54

Please sign in to comment.