Skip to content

Commit fdf1849

Browse files
authored
Merge branch 'master' into floralph/V1787412020
2 parents 3f34419 + da9755a commit fdf1849

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+6236
-266
lines changed

package-lock.json

Lines changed: 8 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/amazonq/package.json

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -560,21 +560,6 @@
560560
]
561561
},
562562
"commands": [
563-
{
564-
"command": "aws.amazonq.stopCmdExecution",
565-
"title": "Stop Amazon Q Command Execution",
566-
"category": "%AWS.amazonq.title%"
567-
},
568-
{
569-
"command": "aws.amazonq.runCmdExecution",
570-
"title": "Run Amazon Q Command Execution",
571-
"category": "%AWS.amazonq.title%"
572-
},
573-
{
574-
"command": "aws.amazonq.rejectCmdExecution",
575-
"title": "Reject Amazon Q Command Execution",
576-
"category": "%AWS.amazonq.title%"
577-
},
578563
{
579564
"command": "_aws.amazonq.notifications.dismiss",
580565
"title": "%AWS.generic.dismiss%",
@@ -865,24 +850,6 @@
865850
}
866851
],
867852
"keybindings": [
868-
{
869-
"command": "aws.amazonq.stopCmdExecution",
870-
"key": "ctrl+shift+backspace",
871-
"mac": "cmd+shift+backspace",
872-
"when": "aws.amazonq.amazonqChatLSP.isRunning"
873-
},
874-
{
875-
"command": "aws.amazonq.runCmdExecution",
876-
"key": "ctrl+shift+enter",
877-
"mac": "cmd+shift+enter",
878-
"when": "aws.amazonq.amazonqChatLSP.isRunning"
879-
},
880-
{
881-
"command": "aws.amazonq.rejectCmdExecution",
882-
"key": "ctrl+shift+r",
883-
"mac": "cmd+shift+r",
884-
"when": "aws.amazonq.amazonqChatLSP.isRunning"
885-
},
886853
{
887854
"command": "_aws.amazonq.focusChat.keybinding",
888855
"win": "win+alt+i",

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

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ export function registerCommands(provider: AmazonQChatViewProvider) {
5959
params: {},
6060
})
6161
})
62-
}),
63-
registerShellCommandShortCut('aws.amazonq.runCmdExecution', 'run-shell-command', provider),
64-
registerShellCommandShortCut('aws.amazonq.rejectCmdExecution', 'reject-shell-command', provider),
65-
registerShellCommandShortCut('aws.amazonq.stopCmdExecution', 'stop-shell-command', provider)
62+
})
6663
)
6764
}
6865

@@ -159,14 +156,3 @@ export async function focusAmazonQPanel() {
159156
await Commands.tryExecute('aws.amazonq.AmazonQChatView.focus')
160157
await Commands.tryExecute('aws.amazonq.AmazonCommonAuth.focus')
161158
}
162-
163-
function registerShellCommandShortCut(commandName: string, buttonId: string, provider: AmazonQChatViewProvider) {
164-
return Commands.register(commandName, async () => {
165-
void focusAmazonQPanel().then(() => {
166-
void provider.webview?.postMessage({
167-
command: 'aws/chat/executeShellCommandShortCut',
168-
params: { id: buttonId },
169-
})
170-
})
171-
})
172-
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
Webview,
1414
} from 'vscode'
1515
import * as path from 'path'
16-
import * as os from 'os'
1716
import {
1817
globals,
1918
isSageMaker,
@@ -150,7 +149,7 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
150149
const vscodeApi = acquireVsCodeApi()
151150
const hybridChatConnector = new HybridChatAdapter(${(await AuthUtil.instance.getChatAuthState()).amazonQ === 'connected'},${featureConfigData},${welcomeCount},${disclaimerAcknowledged},${regionProfileString},${disabledCommands},${isSMUS},${isSM},vscodeApi.postMessage)
152151
const commands = [hybridChatConnector.initialQuickActions[0]]
153-
qChat = amazonQChat.createChat(vscodeApi, {os: "${os.platform()}", disclaimerAcknowledged: ${disclaimerAcknowledged}, pairProgrammingAcknowledged: ${pairProgrammingAcknowledged}, agenticMode: true, quickActionCommands: commands, modelSelectionEnabled: ${modelSelectionEnabled}}, hybridChatConnector, ${JSON.stringify(featureConfigData)});
152+
qChat = amazonQChat.createChat(vscodeApi, {disclaimerAcknowledged: ${disclaimerAcknowledged}, pairProgrammingAcknowledged: ${pairProgrammingAcknowledged}, agenticMode: true, quickActionCommands: commands, modelSelectionEnabled: ${modelSelectionEnabled}}, hybridChatConnector, ${JSON.stringify(featureConfigData)});
154153
}
155154
window.addEventListener('message', (event) => {
156155
/**

packages/amazonq/src/lsp/client.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import {
3939
getClientId,
4040
extensionVersion,
4141
isSageMaker,
42-
setContext,
4342
} from 'aws-core-vscode/shared'
4443
import { processUtils } from 'aws-core-vscode/shared'
4544
import { activate } from './chat/activation'
@@ -166,7 +165,6 @@ export async function startLanguageServer(
166165
pinnedContextEnabled: true,
167166
imageContextEnabled: true,
168167
mcp: true,
169-
shortcut: true,
170168
reroute: true,
171169
modelSelection: true,
172170
workspaceFilePath: vscode.workspace.workspaceFile?.fsPath,
@@ -331,17 +329,6 @@ async function onLanguageServerReady(
331329

332330
if (Experiments.instance.get('amazonqChatLSP', true)) {
333331
await activate(client, encryptionKey, resourcePaths.ui)
334-
335-
await setContext('aws.amazonq.amazonqChatLSP.isRunning', true)
336-
getLogger().info('Amazon Q Chat LSP context flag set on client activated')
337-
338-
// Add a disposable to reset the context flag when the client stops
339-
toDispose.push({
340-
dispose: async () => {
341-
await setContext('aws.amazonq.amazonqChatLSP.isRunning', false)
342-
getLogger().info('Amazon Q Chat LSP context flag reset on client disposal')
343-
},
344-
})
345332
}
346333

347334
const refreshInterval = auth.startTokenRefreshInterval(10 * oneSecond)

packages/core/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,10 @@
609609
"whatwg-url": "^14.0.0",
610610
"winston": "^3.11.0",
611611
"winston-transport": "^4.6.0",
612+
"ws": "^8.16.0",
612613
"xml2js": "^0.6.1",
613614
"yaml-cfn": "^0.3.2",
615+
"protobufjs": "^7.2.6",
614616
"@svgdotjs/svg.js": "^3.0.16",
615617
"svgdom": "^0.1.0",
616618
"jaro-winkler": "^0.2.8"

packages/core/package.nls.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"AWS.configuration.description.amazonq.workspaceIndexCacheDirPath": "The path to the directory that contains the cache of the index of your workspace files",
100100
"AWS.configuration.description.amazonq.ignoredSecurityIssues": "Specifies a list of code issue identifiers that Amazon Q should ignore when reviewing your workspace. Each item in the array should be a unique string identifier for a specific code issue. This allows you to suppress notifications for known issues that you've assessed and determined to be false positives or not applicable to your project. Use this setting with caution, as it may cause you to miss important security alerts.",
101101
"AWS.configuration.description.amazonq.proxy.certificateAuthority": "Path to a Certificate Authority (PEM file) for SSL/TLS verification when using a proxy.",
102-
"AWS.command.apig.invokeRemoteRestApi": "Invoke in the cloud",
102+
"AWS.command.apig.invokeRemoteRestApi": "Invoke remotely",
103103
"AWS.command.apig.invokeRemoteRestApi.cn": "Invoke on Amazon",
104104
"AWS.appBuilder.explorerTitle": "Application Builder",
105105
"AWS.appBuilder.explorerNode.noApps": "[This resource is not yet supported.]",
@@ -159,11 +159,12 @@
159159
"AWS.command.aboutToolkit": "About",
160160
"AWS.command.downloadLambda": "Download...",
161161
"AWS.command.uploadLambda": "Upload Lambda...",
162-
"AWS.command.invokeLambda": "Invoke in the cloud",
162+
"AWS.command.invokeLambda": "Invoke Remotely",
163163
"AWS.command.openLambdaFile": "Open your Lambda code",
164164
"AWS.command.quickDeployLambda": "Save and deploy your code",
165165
"AWS.command.openLambdaWorkspace": "Open in a workspace",
166166
"AWS.command.invokeLambda.cn": "Invoke on Amazon",
167+
"AWS.command.remoteDebugging.clearSnapshot": "Reset Lambda Remote Debugging Snapshot",
167168
"AWS.command.lambda.convertToSam": "Convert to SAM Application",
168169
"AWS.command.refreshAwsExplorer": "Refresh Explorer",
169170
"AWS.command.refreshCdkExplorer": "Refresh CDK Explorer",

packages/core/src/awsService/appBuilder/explorer/nodes/deployedNode.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
s3BucketType,
2828
} from '../../../../shared/cloudformation/cloudformation'
2929
import { ToolkitError } from '../../../../shared/errors'
30+
import { ResourceTreeEntity } from '../samProject'
3031

3132
const localize = nls.loadMessageBundle()
3233
export interface DeployedResource {
@@ -77,7 +78,8 @@ export async function generateDeployedNode(
7778
deployedResource: any,
7879
regionCode: string,
7980
stackName: string,
80-
resourceTreeEntity: any
81+
resourceTreeEntity: ResourceTreeEntity,
82+
location?: vscode.Uri
8183
): Promise<any[]> {
8284
let newDeployedResource: any
8385
const partitionId = globals.regionProvider.getPartitionId(regionCode) ?? defaultPartition
@@ -90,7 +92,13 @@ export async function generateDeployedNode(
9092
try {
9193
configuration = (await defaultClient.getFunction(deployedResource.PhysicalResourceId))
9294
.Configuration as Lambda.FunctionConfiguration
93-
newDeployedResource = new LambdaFunctionNode(lambdaNode, regionCode, configuration)
95+
newDeployedResource = new LambdaFunctionNode(
96+
lambdaNode,
97+
regionCode,
98+
configuration,
99+
undefined,
100+
location ? vscode.Uri.joinPath(location, resourceTreeEntity.CodeUri ?? '').fsPath : undefined
101+
)
94102
} catch (error: any) {
95103
getLogger().error('Error getting Lambda configuration: %O', error)
96104
throw ToolkitError.chain(error, 'Error getting Lambda configuration', {

packages/core/src/awsService/appBuilder/explorer/nodes/resourceNode.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export class ResourceNode implements TreeNode {
6060
this.deployedResource,
6161
this.region,
6262
this.stackName,
63-
this.resourceTreeEntity
63+
this.resourceTreeEntity,
64+
this.location.projectRoot
6465
)
6566
}
6667
if (this.resourceTreeEntity.Type === SERVERLESS_FUNCTION_TYPE) {

packages/core/src/awsService/appBuilder/utils.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,19 +569,24 @@ export async function getLambdaHandlerFile(
569569
})
570570
}
571571

572+
// if this function is used to get handler from a just downloaded lambda function zip. codeUri will be ''
573+
if (codeUri !== '') {
574+
folderUri = vscode.Uri.joinPath(folderUri, codeUri)
575+
}
576+
572577
const handlerParts = handler.split('.')
573578
// sample: app.lambda_handler -> app.rb
574579
if (family === RuntimeFamily.Ruby) {
575580
// Ruby supports namespace/class handlers as well, but the path is
576581
// guaranteed to be slash-delimited so we can assume the first part is
577582
// the path
578-
return vscode.Uri.joinPath(folderUri, codeUri, handlerParts.slice(0, handlerParts.length - 1).join('/') + '.rb')
583+
return vscode.Uri.joinPath(folderUri, handlerParts.slice(0, handlerParts.length - 1).join('/') + '.rb')
579584
}
580585

581586
// sample:app.lambda_handler -> app.py
582587
if (family === RuntimeFamily.Python) {
583588
// Otherwise (currently Node.js and Python) handle dot-delimited paths
584-
return vscode.Uri.joinPath(folderUri, codeUri, handlerParts.slice(0, handlerParts.length - 1).join('/') + '.py')
589+
return vscode.Uri.joinPath(folderUri, handlerParts.slice(0, handlerParts.length - 1).join('/') + '.py')
585590
}
586591

587592
// sample: app.handler -> app.mjs/app.js
@@ -591,23 +596,23 @@ export async function getLambdaHandlerFile(
591596
const handlerPath = path.dirname(handlerName)
592597
const handlerFile = path.basename(handlerName)
593598
const pattern = new vscode.RelativePattern(
594-
vscode.Uri.joinPath(folderUri, codeUri, handlerPath),
595-
`${handlerFile}.{js,mjs}`
599+
vscode.Uri.joinPath(folderUri, handlerPath),
600+
`${handlerFile}.{js,mjs,cjs,ts}`
596601
)
597602
return searchHandlerFile(folderUri, pattern)
598603
}
599604
// search directly under Code uri for Dotnet and java
600605
// sample: ImageResize::ImageResize.Function::FunctionHandler -> Function.cs
601606
if (family === RuntimeFamily.DotNet) {
602607
const handlerName = path.basename(handler.split('::')[1].replaceAll('.', '/'))
603-
const pattern = new vscode.RelativePattern(vscode.Uri.joinPath(folderUri, codeUri), `${handlerName}.cs`)
608+
const pattern = new vscode.RelativePattern(folderUri, `${handlerName}.cs`)
604609
return searchHandlerFile(folderUri, pattern)
605610
}
606611

607612
// sample: resizer.App::handleRequest -> App.java
608613
if (family === RuntimeFamily.Java) {
609614
const handlerName = handler.split('::')[0].replaceAll('.', '/')
610-
const pattern = new vscode.RelativePattern(vscode.Uri.joinPath(folderUri, codeUri), `**/${handlerName}.java`)
615+
const pattern = new vscode.RelativePattern(folderUri, `**/${handlerName}.java`)
611616
return searchHandlerFile(folderUri, pattern)
612617
}
613618
}

0 commit comments

Comments
 (0)