Skip to content

Commit f7f19ef

Browse files
Merge master into feature/q-dev-ux
2 parents 48d6522 + 0650ff4 commit f7f19ef

File tree

5 files changed

+19
-15
lines changed

5 files changed

+19
-15
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Amazon Q extension may fail to start if AWS Toolkit extension fails to start"
4+
}

packages/core/src/codewhisperer/commands/basicCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ export const registerToolkitApiCallback = Commands.declare(
462462
} else if (isExtensionActive(VSCODE_EXTENSION_ID.awstoolkit)) {
463463
// when this command is executed by Amazon Q activation
464464
const toolkitExt = vscode.extensions.getExtension(VSCODE_EXTENSION_ID.awstoolkit)
465-
_toolkitApi = toolkitExt?.exports.getApi(VSCODE_EXTENSION_ID.amazonq)
465+
_toolkitApi = toolkitExt?.exports?.getApi(VSCODE_EXTENSION_ID.amazonq)
466466
}
467467
if (_toolkitApi) {
468468
registerToolkitApiCallbackOnce()

packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,22 @@ export class Messenger {
9191
)
9292
)
9393
}
94-
94+
/**
95+
* Tries to calculate the total number of code blocks.
96+
* NOTES:
97+
* - Not correct on all examples. Some may cause it to return 0 unexpectedly.
98+
* - Plans in place (as of 4/22/2024) to move this server side.
99+
* - See original pr: https://github.com/aws/aws-toolkit-vscode/pull/4761 for more details.
100+
* @param message raw message response from codewhisperer client.
101+
* @returns count of multi-line code blocks in response.
102+
*/
95103
public async countTotalNumberOfCodeBlocks(message: string): Promise<number> {
104+
//TODO: remove this when moved to server-side.
96105
if (message === undefined) {
97106
return 0
98107
}
99108

100-
// // To Convert Markdown text to HTML using marked library
109+
// To Convert Markdown text to HTML using marked library
101110
const html = await marked(message)
102111

103112
const dom = new JSDOM(html)

packages/core/src/login/webview/vue/amazonq/backend_amazonq.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class AmazonQLoginWebview extends CommonAuthWebview {
4545
}
4646
await activateExtension(VSCODE_EXTENSION_ID.awstoolkit)
4747
const toolkitExt = vscode.extensions.getExtension(VSCODE_EXTENSION_ID.awstoolkit)
48-
const importedApi = toolkitExt?.exports.getApi(VSCODE_EXTENSION_ID.amazonq)
48+
const importedApi = toolkitExt?.exports?.getApi(VSCODE_EXTENSION_ID.amazonq)
4949
if (importedApi && 'listConnections' in importedApi) {
5050
return ((await importedApi?.listConnections()) as AwsConnection[]).filter(
5151
// No need to display Builder ID as an existing connection,

packages/core/src/test/shared/credentials/userCredentialsUtils.test.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@ import { makeTemporaryToolkitFolder } from '../../../shared/filesystemUtilities'
2121
import { getConfigFilename, getCredentialsFilename } from '../../../auth/credentials/sharedCredentialsFile'
2222
import { fs } from '../../../shared'
2323

24-
/** Async version of "doesNotThrow" */
25-
async function assertDoesNotThrow(fn: () => Promise<void>): Promise<void> {
26-
try {
27-
await fn()
28-
} catch (err) {
29-
assert.fail(`Provided function threw error ${err}`)
30-
}
31-
}
32-
3324
describe('UserCredentialsUtils', function () {
3425
let tempFolder: string
3526
let defaultConfigFileName: string
@@ -151,8 +142,8 @@ describe('UserCredentialsUtils', function () {
151142
`creds.secretKey: "${profile.aws_access_key_id}" !== "${creds.secretKey}"`
152143
)
153144

154-
await assertDoesNotThrow(async () => await fs.checkPerms(credentialsFilename, 'r--'))
155-
await assertDoesNotThrow(async () => await fs.checkPerms(credentialsFilename, '-w-'))
145+
await assert.doesNotReject(async () => await fs.checkPerms(credentialsFilename, 'r--'))
146+
await assert.doesNotReject(async () => await fs.checkPerms(credentialsFilename, '-w-'))
156147
})
157148
})
158149

0 commit comments

Comments
 (0)