Skip to content

Commit c8c92b8

Browse files
authored
fix(codewhisperer): skip activation when disabled #2736
Problem: For troubleshooting issues potentially related to codewhisperer, it is useful for users to be able to fully disable codewhisperer to rule it out as a possible cause. But codewhisperer activate() is called even when it is disabled in settings, and this creates various handlers for numerous vscode events, which could be a potential source of performance issues or other bugs. Solution: Skip codewhisperer activation entirely if it is disabled in settings.
1 parent 51dcb64 commit c8c92b8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
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": "CodeWhisperer features were not fully disabled if the experiment was disabled"
4+
}

src/codewhisperer/activation.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ import { Commands } from '../shared/vscode/commands2'
4848
const performance = globalThis.performance ?? require('perf_hooks').performance
4949

5050
export async function activate(context: ExtContext): Promise<void> {
51+
const codewhispererSettings = CodeWhispererSettings.instance
52+
if (!codewhispererSettings.isEnabled()) {
53+
return
54+
}
55+
5156
/**
5257
* Enable essential intellisense default settings for AWS C9 IDE
5358
*/
@@ -64,7 +69,6 @@ export async function activate(context: ExtContext): Promise<void> {
6469
/**
6570
* Service control
6671
*/
67-
const codewhispererSettings = CodeWhispererSettings.instance
6872
const client = new codewhispererClient.DefaultCodeWhispererClient()
6973

7074
const referenceHoverProvider = new ReferenceHoverProvider()

0 commit comments

Comments
 (0)