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": "Toast message to warn users if Developer Profile is not selected"
}
4 changes: 4 additions & 0 deletions packages/amazonq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@
"amazonQChatDisclaimer": {
"type": "boolean",
"default": false
},
"amazonQSelectDeveloperProfile": {
"type": "boolean",
"default": false
}
},
"additionalProperties": false
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/codewhisperer/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ import { SecurityIssueTreeViewProvider } from './service/securityIssueTreeViewPr
import { setContext } from '../shared/vscode/setContext'
import { syncSecurityIssueWebview } from './views/securityIssue/securityIssueWebview'
import { detectCommentAboveLine } from '../shared/utilities/commentUtils'
import { notifySelectDeveloperProfile } from './region/utils'

let localize: nls.LocalizeFunc

Expand Down Expand Up @@ -380,6 +381,10 @@ export async function activate(context: ExtContext): Promise<void> {
await auth.notifySessionConfiguration()
}
}

if (auth.requireProfileSelection()) {
await notifySelectDeveloperProfile()
}
},
{ emit: false, functionId: { name: 'activateCwCore' } }
)
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/codewhisperer/commands/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export const firstStartUpSource = ExtStartUpSources.firstStartUp
export const cwEllipsesMenu = 'ellipsesMenu'
/** Indicates a CodeWhisperer command was executed from the command palette */
export const commandPalette = 'commandPalette'
/** Indicates a CodeWhisperer command was executed as a result of a toast message interaction */
export const toastMessage = 'toastMessage'

/**
* Indicates what caused the CodeWhisperer command to be executed, since a command can be executed from different "sources"
Expand All @@ -35,3 +37,4 @@ export type CodeWhispererSource =
| typeof firstStartUpSource
| typeof cwEllipsesMenu
| typeof commandPalette
| typeof toastMessage
49 changes: 49 additions & 0 deletions packages/core/src/codewhisperer/region/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*!
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import * as nls from 'vscode-nls'
const localize = nls.loadMessageBundle()
import { AmazonQPromptSettings } from '../../shared/settings'
import { telemetry } from '../../shared/telemetry/telemetry'
import vscode from 'vscode'
import { selectRegionProfileCommand } from '../commands/basicCommands'
import { placeholder } from '../../shared/vscode/commands2'
import { toastMessage } from '../commands/types'

/**
* Creates a toast message telling the user they need to select a Developer Profile
*/
export async function notifySelectDeveloperProfile() {
const suppressId = 'amazonQSelectDeveloperProfile'
const settings = AmazonQPromptSettings.instance
const shouldShow = settings.isPromptEnabled(suppressId)
if (!shouldShow) {
return
}

const message = localize(
'aws.amazonq.profile.mustSelectMessage',
'You must select a Q Developer Profile for Amazon Q features to work.'
)
const selectProfile = 'Select Profile'
const dontShowAgain = 'Dont Show Again'

await telemetry.toolkit_showNotification.run(async () => {
telemetry.record({ id: 'mustSelectDeveloperProfileMessage' })
void vscode.window.showWarningMessage(message, selectProfile, dontShowAgain).then(async (resp) => {
await telemetry.toolkit_invokeAction.run(async () => {
if (resp === selectProfile) {
// Show Profile
telemetry.record({ action: 'select' })
void selectRegionProfileCommand.execute(placeholder, toastMessage)
} else if (resp === dontShowAgain) {
telemetry.record({ action: 'dontShowAgain' })
await settings.disablePrompt(suppressId)
} else {
telemetry.record({ action: 'ignore' })
}
})
})
})
}
1 change: 1 addition & 0 deletions packages/core/src/codewhisperer/util/authUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { withTelemetryContext } from '../../shared/telemetry/util'
import { focusAmazonQPanel } from '../../codewhispererChat/commands/registerCommands'
import { throttle } from 'lodash'
import { RegionProfileManager } from '../region/regionProfileManager'

/** Backwards compatibility for connections w pre-chat scopes */
export const codeWhispererCoreScopes = [...scopesCodeWhispererCore]
export const codeWhispererChatScopes = [...codeWhispererCoreScopes, ...scopesCodeWhispererChat]
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/shared/settings-amazonq.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export const amazonqSettings = {
"ssoCacheError": {},
"amazonQLspManifestMessage": {},
"amazonQWorkspaceLspManifestMessage": {},
"amazonQChatDisclaimer": {}
"amazonQChatDisclaimer": {},
"amazonQSelectDeveloperProfile": {}
},
"amazonQ.showCodeWithReferences": {},
"amazonQ.allowFeatureDevelopmentToRunCodeAndTests": {},
Expand Down
Loading