Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Amazon Q extension may fail to start if AWS Toolkit extension fails to start"
}
2 changes: 1 addition & 1 deletion packages/core/src/codewhisperer/commands/basicCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ export const registerToolkitApiCallback = Commands.declare(
} else if (isExtensionActive(VSCODE_EXTENSION_ID.awstoolkit)) {
// when this command is executed by Amazon Q activation
const toolkitExt = vscode.extensions.getExtension(VSCODE_EXTENSION_ID.awstoolkit)
_toolkitApi = toolkitExt?.exports.getApi(VSCODE_EXTENSION_ID.amazonq)
_toolkitApi = toolkitExt?.exports?.getApi(VSCODE_EXTENSION_ID.amazonq)
}
if (_toolkitApi) {
registerToolkitApiCallbackOnce()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class AmazonQLoginWebview extends CommonAuthWebview {
}
await activateExtension(VSCODE_EXTENSION_ID.awstoolkit)
const toolkitExt = vscode.extensions.getExtension(VSCODE_EXTENSION_ID.awstoolkit)
const importedApi = toolkitExt?.exports.getApi(VSCODE_EXTENSION_ID.amazonq)
const importedApi = toolkitExt?.exports?.getApi(VSCODE_EXTENSION_ID.amazonq)
if (importedApi && 'listConnections' in importedApi) {
return ((await importedApi?.listConnections()) as AwsConnection[]).filter(
// No need to display Builder ID as an existing connection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ import { makeTemporaryToolkitFolder } from '../../../shared/filesystemUtilities'
import { getConfigFilename, getCredentialsFilename } from '../../../auth/credentials/sharedCredentialsFile'
import { fs } from '../../../shared'

/** Async version of "doesNotThrow" */
async function assertDoesNotThrow(fn: () => Promise<void>): Promise<void> {
try {
await fn()
} catch (err) {
assert.fail(`Provided function threw error ${err}`)
}
}

describe('UserCredentialsUtils', function () {
let tempFolder: string
let defaultConfigFileName: string
Expand Down Expand Up @@ -151,8 +142,8 @@ describe('UserCredentialsUtils', function () {
`creds.secretKey: "${profile.aws_access_key_id}" !== "${creds.secretKey}"`
)

await assertDoesNotThrow(async () => await fs.checkPerms(credentialsFilename, 'r--'))
await assertDoesNotThrow(async () => await fs.checkPerms(credentialsFilename, '-w-'))
await assert.doesNotReject(async () => await fs.checkPerms(credentialsFilename, 'r--'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes somehow related to this PR? Otherwise the change looks good to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no just a fixup for a recent commit

await assert.doesNotReject(async () => await fs.checkPerms(credentialsFilename, '-w-'))
})
})

Expand Down
Loading