Skip to content

Commit 2180bda

Browse files
authored
fix codewhisperer command not found error when codewhisperer is disabled (#3518)
* fix codewhisperer command not found error when codewhisperer is disabled * fix bug introduced by previous fix commit * changelog
1 parent 77fd8c6 commit 2180bda

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
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": "Fix CodeWhisperer not found error when it is disabled by users issue #3490"
4+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3157,7 +3157,7 @@
31573157
"command": "aws.codeWhisperer",
31583158
"key": "alt+c",
31593159
"mac": "alt+c",
3160-
"when": "editorTextFocus"
3160+
"when": "editorTextFocus && CODEWHISPERER_ENABLED"
31613161
},
31623162
{
31633163
"command": "aws.codeWhisperer.rejectCodeSuggestion",

src/codewhisperer/activation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ export async function activate(context: ExtContext): Promise<void> {
255255
setSubscriptionsforCloud9()
256256
} else if (isInlineCompletionEnabled()) {
257257
await setSubscriptionsforInlineCompletion()
258-
await vscode.commands.executeCommand('setContext', 'CODEWHISPERER_ENABLED', true)
258+
await vscode.commands.executeCommand('setContext', 'CODEWHISPERER_ENABLED', AuthUtil.instance.isConnected())
259259
}
260260

261261
async function setSubscriptionsforInlineCompletion() {

src/codewhisperer/util/authUtil.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export class AuthUtil {
7272
vscode.commands.executeCommand('aws.codeWhisperer.refreshStatusBar'),
7373
vscode.commands.executeCommand('aws.codeWhisperer.updateReferenceLog'),
7474
])
75+
76+
await vscode.commands.executeCommand('setContext', 'CODEWHISPERER_ENABLED', this.isConnected())
7577
})
7678
}
7779

0 commit comments

Comments
 (0)