Skip to content

Commit 8ece808

Browse files
fix(amazonq): Warn user Developer Profile not selected (#7160)
## Problem: If a user has not selected Q Developer Profile after signing in, their features will not work. Some existing users, before the introduction of Q Developer Profiles, who were already signed in had their features stop working because they didn't select a profile. ## Solution: On startup if we detect the user did not select a profile, then send a warning message that their features will not work until they select one. The message will have a button to allow them to select a profile through quickpick, or entirly ignore the message and not show it again. <img width="753" alt="Screenshot 2025-04-24 at 5 42 51 PM" src="https://github.com/user-attachments/assets/2429badf-8131-48f8-9ba9-ea81423c9c60" /> --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Signed-off-by: nkomonen-amazon <[email protected]>
1 parent c22efa0 commit 8ece808

File tree

7 files changed

+68
-1
lines changed

7 files changed

+68
-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": "Toast message to warn users if Developer Profile is not selected"
4+
}

packages/amazonq/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@
131131
"amazonQChatDisclaimer": {
132132
"type": "boolean",
133133
"default": false
134+
},
135+
"amazonQSelectDeveloperProfile": {
136+
"type": "boolean",
137+
"default": false
134138
}
135139
},
136140
"additionalProperties": false

packages/core/src/codewhisperer/activation.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ import { SecurityIssueTreeViewProvider } from './service/securityIssueTreeViewPr
9595
import { setContext } from '../shared/vscode/setContext'
9696
import { syncSecurityIssueWebview } from './views/securityIssue/securityIssueWebview'
9797
import { detectCommentAboveLine } from '../shared/utilities/commentUtils'
98+
import { notifySelectDeveloperProfile } from './region/utils'
9899

99100
let localize: nls.LocalizeFunc
100101

@@ -380,6 +381,10 @@ export async function activate(context: ExtContext): Promise<void> {
380381
await auth.notifySessionConfiguration()
381382
}
382383
}
384+
385+
if (auth.requireProfileSelection()) {
386+
await notifySelectDeveloperProfile()
387+
}
383388
},
384389
{ emit: false, functionId: { name: 'activateCwCore' } }
385390
)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export const firstStartUpSource = ExtStartUpSources.firstStartUp
1818
export const cwEllipsesMenu = 'ellipsesMenu'
1919
/** Indicates a CodeWhisperer command was executed from the command palette */
2020
export const commandPalette = 'commandPalette'
21+
/** Indicates a CodeWhisperer command was executed as a result of a toast message interaction */
22+
export const toastMessage = 'toastMessage'
2123

2224
/**
2325
* Indicates what caused the CodeWhisperer command to be executed, since a command can be executed from different "sources"
@@ -35,3 +37,4 @@ export type CodeWhispererSource =
3537
| typeof firstStartUpSource
3638
| typeof cwEllipsesMenu
3739
| typeof commandPalette
40+
| typeof toastMessage
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
import * as nls from 'vscode-nls'
6+
const localize = nls.loadMessageBundle()
7+
import { AmazonQPromptSettings } from '../../shared/settings'
8+
import { telemetry } from '../../shared/telemetry/telemetry'
9+
import vscode from 'vscode'
10+
import { selectRegionProfileCommand } from '../commands/basicCommands'
11+
import { placeholder } from '../../shared/vscode/commands2'
12+
import { toastMessage } from '../commands/types'
13+
14+
/**
15+
* Creates a toast message telling the user they need to select a Developer Profile
16+
*/
17+
export async function notifySelectDeveloperProfile() {
18+
const suppressId = 'amazonQSelectDeveloperProfile'
19+
const settings = AmazonQPromptSettings.instance
20+
const shouldShow = settings.isPromptEnabled(suppressId)
21+
if (!shouldShow) {
22+
return
23+
}
24+
25+
const message = localize(
26+
'aws.amazonq.profile.mustSelectMessage',
27+
'You must select a Q Developer Profile for Amazon Q features to work.'
28+
)
29+
const selectProfile = 'Select Profile'
30+
const dontShowAgain = 'Dont Show Again'
31+
32+
await telemetry.toolkit_showNotification.run(async () => {
33+
telemetry.record({ id: 'mustSelectDeveloperProfileMessage' })
34+
void vscode.window.showWarningMessage(message, selectProfile, dontShowAgain).then(async (resp) => {
35+
await telemetry.toolkit_invokeAction.run(async () => {
36+
if (resp === selectProfile) {
37+
// Show Profile
38+
telemetry.record({ action: 'select' })
39+
void selectRegionProfileCommand.execute(placeholder, toastMessage)
40+
} else if (resp === dontShowAgain) {
41+
telemetry.record({ action: 'dontShowAgain' })
42+
await settings.disablePrompt(suppressId)
43+
} else {
44+
telemetry.record({ action: 'ignore' })
45+
}
46+
})
47+
})
48+
})
49+
}

packages/core/src/codewhisperer/util/authUtil.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { withTelemetryContext } from '../../shared/telemetry/util'
4646
import { focusAmazonQPanel } from '../../codewhispererChat/commands/registerCommands'
4747
import { throttle } from 'lodash'
4848
import { RegionProfileManager } from '../region/regionProfileManager'
49+
4950
/** Backwards compatibility for connections w pre-chat scopes */
5051
export const codeWhispererCoreScopes = [...scopesCodeWhispererCore]
5152
export const codeWhispererChatScopes = [...codeWhispererCoreScopes, ...scopesCodeWhispererChat]

packages/core/src/shared/settings-amazonq.gen.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ export const amazonqSettings = {
2121
"ssoCacheError": {},
2222
"amazonQLspManifestMessage": {},
2323
"amazonQWorkspaceLspManifestMessage": {},
24-
"amazonQChatDisclaimer": {}
24+
"amazonQChatDisclaimer": {},
25+
"amazonQSelectDeveloperProfile": {}
2526
},
2627
"amazonQ.showCodeWithReferences": {},
2728
"amazonQ.allowFeatureDevelopmentToRunCodeAndTests": {},

0 commit comments

Comments
 (0)