Skip to content

Commit 3966878

Browse files
leigaoljustinmk3chungjac
authored
fix(amazonq): merge master into feature/flare-mega (#7456)
## Problem ## Solution --- - 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. --------- Co-authored-by: Justin M. Keyes <[email protected]> Co-authored-by: chungjac <[email protected]>
1 parent ad93067 commit 3966878

File tree

12 files changed

+70
-14
lines changed

12 files changed

+70
-14
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Add MCP Server Support"
4+
}

packages/amazonq/package.json

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,16 +387,21 @@
387387
"when": "view == aws.amazonq.AmazonQChatView",
388388
"group": "0_topAmazonQ@1"
389389
},
390-
{
391-
"command": "aws.amazonq.learnMore",
392-
"when": "view =~ /^aws\\.amazonq/",
393-
"group": "1_amazonQ@1"
394-
},
395390
{
396391
"command": "aws.amazonq.selectRegionProfile",
397392
"when": "view == aws.amazonq.AmazonQChatView && aws.amazonq.connectedSsoIdc == true",
398393
"group": "1_amazonQ@1"
399394
},
395+
{
396+
"command": "aws.amazonq.manageSubscription",
397+
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connected",
398+
"group": "1_amazonQ@2"
399+
},
400+
{
401+
"command": "aws.amazonq.learnMore",
402+
"when": "view =~ /^aws\\.amazonq/",
403+
"group": "1_amazonQ@3"
404+
},
400405
{
401406
"command": "aws.amazonq.signout",
402407
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connected && !aws.isSageMakerUnifiedStudio",
@@ -678,6 +683,13 @@
678683
"category": "%AWS.amazonq.title%",
679684
"icon": "$(question)"
680685
},
686+
{
687+
"command": "aws.amazonq.manageSubscription",
688+
"title": "%AWS.command.manageSubscription%",
689+
"category": "%AWS.amazonq.title%",
690+
"icon": "$(gear)",
691+
"enablement": "aws.codewhisperer.connected && !aws.amazonq.connectedSsoIdc"
692+
},
681693
{
682694
"command": "aws.amazonq.signout",
683695
"title": "%AWS.command.codewhisperer.signout%",

packages/amazonq/src/lsp/chat/activation.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { window } from 'vscode'
77
import { LanguageClient } from 'vscode-languageclient'
88
import { AmazonQChatViewProvider } from './webviewProvider'
9-
import { registerCommands } from './commands'
9+
import { focusAmazonQPanel, registerCommands } from './commands'
1010
import { registerLanguageServerEventListener, registerMessageListeners } from './messages'
1111
import { Commands, getLogger, globals, undefinedIfEmpty } from 'aws-core-vscode/shared'
1212
import { activate as registerLegacyChatListeners } from '../../app/chat/activation'
@@ -78,6 +78,18 @@ export async function activate(languageClient: LanguageClient, encryptionKey: Bu
7878
Commands.register('aws.amazonq.updateCustomizations', () => {
7979
pushCustomizationToServer(languageClient)
8080
}),
81+
Commands.register('aws.amazonq.manageSubscription', () => {
82+
focusAmazonQPanel().catch((e) => languageClient.error(`[VSCode Client] focusAmazonQPanel() failed`))
83+
84+
languageClient
85+
.sendRequest('workspace/executeCommand', {
86+
command: 'aws/chat/manageSubscription',
87+
// arguments: [],
88+
})
89+
.catch((e) => {
90+
getLogger('amazonqLsp').error('failed request: aws/chat/manageSubscription: %O', e)
91+
})
92+
}),
8193
globals.logOutputChannel.onDidChangeLogLevel((logLevel) => {
8294
getLogger('amazonqLsp').info(`Local log level changed to ${logLevel}, notifying LSP`)
8395
void pushConfigUpdate(languageClient, {

packages/amazonq/src/lsp/chat/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function registerGenericCommand(commandName: string, genericCommand: string, pro
125125
*
126126
* Instead, we just create our own as a temporary solution
127127
*/
128-
async function focusAmazonQPanel() {
128+
export async function focusAmazonQPanel() {
129129
await Commands.tryExecute('aws.amazonq.AmazonQChatView.focus')
130130
await Commands.tryExecute('aws.amazonq.AmazonCommonAuth.focus')
131131
}

packages/amazonq/src/lsp/chat/messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export function registerMessageListeners(
316316
)
317317
if (!buttonResult.success) {
318318
languageClient.error(
319-
`[VSCode Client] Failed to execute action associated with button with reason: ${buttonResult.failureReason}`
319+
`[VSCode Client] Failed to execute button action: ${buttonResult.failureReason}`
320320
)
321321
}
322322
break

packages/amazonq/src/lsp/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export async function startLanguageServer(
150150
awsClientCapabilities: {
151151
q: {
152152
developerProfiles: true,
153+
mcp: true,
153154
},
154155
window: {
155156
notifications: true,

packages/core/package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
"AWS.command.codecatalyst.login": "Connect to CodeCatalyst",
138138
"AWS.command.codecatalyst.logout": "Sign out of CodeCatalyst",
139139
"AWS.command.codecatalyst.signout": "Sign Out",
140+
"AWS.command.manageSubscription": "Manage Q Developer Pro Subscription",
140141
"AWS.command.amazonq.explainCode": "Explain",
141142
"AWS.command.amazonq.refactorCode": "Refactor",
142143
"AWS.command.amazonq.fixCode": "Fix",

packages/core/src/auth/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ export * as cache from './sso/cache'
2828
export * as authUtils from './utils'
2929
export * as auth2 from './auth2'
3030
export * as SsoAccessTokenProvider from './sso/ssoAccessTokenProvider'
31+
export * as AuthUtils from './utils'
32+
export * as credentialsValidation from './credentials/validation'

packages/core/src/codewhisperer/ui/codeWhispererNodes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,18 @@ export function createGettingStarted(): DataQuickPickItem<'gettingStarted'> {
177177
} as DataQuickPickItem<'gettingStarted'>
178178
}
179179

180+
export function createManageSubscription(): DataQuickPickItem<'manageSubscription'> {
181+
const label = localize('AWS.command.manageSubscription', 'Manage Q Developer Pro Subscription')
182+
// const kind = AuthUtil.instance.isBuilderIdInUse() ? 'AWS Builder ID' : 'IAM Identity Center'
183+
184+
return {
185+
data: 'manageSubscription',
186+
label: label,
187+
iconPath: getIcon('vscode-link-external'),
188+
onClick: () => Commands.tryExecute('aws.amazonq.manageSubscription'),
189+
} as DataQuickPickItem<'manageSubscription'>
190+
}
191+
180192
export function createSignout(): DataQuickPickItem<'signout'> {
181193
const label = localize('AWS.codewhisperer.signoutNode.label', 'Sign Out')
182194
const icon = getIcon('vscode-export')

packages/core/src/codewhisperer/ui/statusBarMenu.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
createSelectCustomization,
1212
createReconnect,
1313
createGettingStarted,
14+
createManageSubscription,
1415
createSignout,
1516
createSeparator,
1617
createSettingsNode,
@@ -106,7 +107,7 @@ export function getQuickPickItems(): DataQuickPickItem<string>[] {
106107
createSettingsNode(),
107108
...(AuthUtil.instance.isIdcConnection() && regionProfile ? [createSelectRegionProfileNode(regionProfile)] : []),
108109
...(AuthUtil.instance.isConnected() && !hasVendedIamCredentials() && !hasVendedCredentialsFromMetadata()
109-
? [createSignout()]
110+
? [createManageSubscription(), createSignout()]
110111
: []),
111112
]
112113

0 commit comments

Comments
 (0)