Skip to content

Commit dc675eb

Browse files
Merge master into feature/emr
2 parents 3cc404a + 0458325 commit dc675eb

File tree

13 files changed

+74
-14
lines changed

13 files changed

+74
-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
@@ -388,16 +388,21 @@
388388
"when": "view == aws.amazonq.AmazonQChatView",
389389
"group": "0_topAmazonQ@1"
390390
},
391-
{
392-
"command": "aws.amazonq.learnMore",
393-
"when": "view =~ /^aws\\.amazonq/",
394-
"group": "1_amazonQ@1"
395-
},
396391
{
397392
"command": "aws.amazonq.selectRegionProfile",
398393
"when": "view == aws.amazonq.AmazonQChatView && aws.amazonq.connectedSsoIdc == true",
399394
"group": "1_amazonQ@1"
400395
},
396+
{
397+
"command": "aws.amazonq.manageSubscription",
398+
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connected",
399+
"group": "1_amazonQ@2"
400+
},
401+
{
402+
"command": "aws.amazonq.learnMore",
403+
"when": "view =~ /^aws\\.amazonq/",
404+
"group": "1_amazonQ@3"
405+
},
401406
{
402407
"command": "aws.amazonq.signout",
403408
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connected && !aws.isSageMakerUnifiedStudio",
@@ -679,6 +684,13 @@
679684
"category": "%AWS.amazonq.title%",
680685
"icon": "$(question)"
681686
},
687+
{
688+
"command": "aws.amazonq.manageSubscription",
689+
"title": "%AWS.command.manageSubscription%",
690+
"category": "%AWS.amazonq.title%",
691+
"icon": "$(gear)",
692+
"enablement": "aws.codewhisperer.connected && !aws.amazonq.connectedSsoIdc"
693+
},
682694
{
683695
"command": "aws.amazonq.signout",
684696
"title": "%AWS.command.codewhisperer.signout%",

packages/amazonq/src/lsp/auth.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ export class AmazonQLspAuth {
9696
token,
9797
})
9898

99+
// "aws/credentials/token/update"
100+
// https://github.com/aws/language-servers/blob/44d81f0b5754747d77bda60b40cc70950413a737/core/aws-lsp-core/src/credentials/credentialsProvider.ts#L27
99101
await this.client.sendRequest(bearerCredentialsUpdateRequestType.method, request)
100102

101103
this.client.info(`UpdateBearerToken: ${JSON.stringify(request)}`)

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'
@@ -73,6 +73,18 @@ export async function activate(languageClient: LanguageClient, encryptionKey: Bu
7373
customization: undefinedIfEmpty(getSelectedCustomization().arn),
7474
})
7575
}),
76+
Commands.register('aws.amazonq.manageSubscription', () => {
77+
focusAmazonQPanel().catch((e) => languageClient.error(`[VSCode Client] focusAmazonQPanel() failed`))
78+
79+
languageClient
80+
.sendRequest('workspace/executeCommand', {
81+
command: 'aws/chat/manageSubscription',
82+
// arguments: [],
83+
})
84+
.catch((e) => {
85+
getLogger('amazonqLsp').error('failed request: aws/chat/manageSubscription: %O', e)
86+
})
87+
}),
7688
globals.logOutputChannel.onDidChangeLogLevel((logLevel) => {
7789
getLogger('amazonqLsp').info(`Local log level changed to ${logLevel}, notifying LSP`)
7890
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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ import {
7272
} from 'aws-core-vscode/amazonq'
7373
import { telemetry, TelemetryBase } from 'aws-core-vscode/telemetry'
7474
import { isValidResponseError } from './error'
75+
import { focusAmazonQPanel } from './commands'
7576

7677
export function registerLanguageServerEventListener(languageClient: LanguageClient, provider: AmazonQChatViewProvider) {
7778
languageClient.info(
@@ -334,7 +335,7 @@ export function registerMessageListeners(
334335
)
335336
if (!buttonResult.success) {
336337
languageClient.error(
337-
`[VSCode Client] Failed to execute action associated with button with reason: ${buttonResult.failureReason}`
338+
`[VSCode Client] Failed to execute button action: ${buttonResult.failureReason}`
338339
)
339340
}
340341
break
@@ -433,6 +434,8 @@ export function registerMessageListeners(
433434
languageClient.onRequest<ShowDocumentParams, ShowDocumentResult>(
434435
ShowDocumentRequest.method,
435436
async (params: ShowDocumentParams): Promise<ShowDocumentParams | ResponseError<ShowDocumentResult>> => {
437+
focusAmazonQPanel().catch((e) => languageClient.error(`[VSCode Client] focusAmazonQPanel() failed`))
438+
436439
try {
437440
const uri = vscode.Uri.parse(params.uri)
438441

packages/amazonq/src/lsp/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export async function startLanguageServer(
123123
awsClientCapabilities: {
124124
q: {
125125
developerProfiles: true,
126+
mcp: true,
126127
},
127128
window: {
128129
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ export { Auth } from './auth'
2424
export { CredentialsStore } from './credentials/store'
2525
export { LoginManager } from './deprecated/loginManager'
2626
export * as AuthUtils from './utils'
27+
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
@@ -176,6 +176,18 @@ export function createGettingStarted(): DataQuickPickItem<'gettingStarted'> {
176176
} as DataQuickPickItem<'gettingStarted'>
177177
}
178178

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

0 commit comments

Comments
 (0)