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
27 changes: 8 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,10 @@
"whatwg-url": "^14.0.0",
"winston": "^3.11.0",
"winston-transport": "^4.6.0",
"ws": "^8.16.0",
"xml2js": "^0.6.1",
"yaml-cfn": "^0.3.2",
"protobufjs": "^7.2.6",
"@svgdotjs/svg.js": "^3.0.16",
"svgdom": "^0.1.0",
"jaro-winkler": "^0.2.8"
Expand Down
5 changes: 3 additions & 2 deletions packages/core/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"AWS.configuration.description.amazonq.workspaceIndexCacheDirPath": "The path to the directory that contains the cache of the index of your workspace files",
"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.",
"AWS.configuration.description.amazonq.proxy.certificateAuthority": "Path to a Certificate Authority (PEM file) for SSL/TLS verification when using a proxy.",
"AWS.command.apig.invokeRemoteRestApi": "Invoke in the cloud",
"AWS.command.apig.invokeRemoteRestApi": "Invoke remotely",
"AWS.command.apig.invokeRemoteRestApi.cn": "Invoke on Amazon",
"AWS.appBuilder.explorerTitle": "Application Builder",
"AWS.appBuilder.explorerNode.noApps": "[This resource is not yet supported.]",
Expand Down Expand Up @@ -159,11 +159,12 @@
"AWS.command.aboutToolkit": "About",
"AWS.command.downloadLambda": "Download...",
"AWS.command.uploadLambda": "Upload Lambda...",
"AWS.command.invokeLambda": "Invoke in the cloud",
"AWS.command.invokeLambda": "Invoke Remotely",
"AWS.command.openLambdaFile": "Open your Lambda code",
"AWS.command.quickDeployLambda": "Save and deploy your code",
"AWS.command.openLambdaWorkspace": "Open in a workspace",
"AWS.command.invokeLambda.cn": "Invoke on Amazon",
"AWS.command.remoteDebugging.clearSnapshot": "Reset Lambda Remote Debugging Snapshot",
"AWS.command.lambda.convertToSam": "Convert to SAM Application",
"AWS.command.refreshAwsExplorer": "Refresh Explorer",
"AWS.command.refreshCdkExplorer": "Refresh CDK Explorer",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
s3BucketType,
} from '../../../../shared/cloudformation/cloudformation'
import { ToolkitError } from '../../../../shared/errors'
import { ResourceTreeEntity } from '../samProject'

const localize = nls.loadMessageBundle()
export interface DeployedResource {
Expand Down Expand Up @@ -77,7 +78,8 @@ export async function generateDeployedNode(
deployedResource: any,
regionCode: string,
stackName: string,
resourceTreeEntity: any
resourceTreeEntity: ResourceTreeEntity,
location?: vscode.Uri
): Promise<any[]> {
let newDeployedResource: any
const partitionId = globals.regionProvider.getPartitionId(regionCode) ?? defaultPartition
Expand All @@ -90,7 +92,13 @@ export async function generateDeployedNode(
try {
configuration = (await defaultClient.getFunction(deployedResource.PhysicalResourceId))
.Configuration as Lambda.FunctionConfiguration
newDeployedResource = new LambdaFunctionNode(lambdaNode, regionCode, configuration)
newDeployedResource = new LambdaFunctionNode(
lambdaNode,
regionCode,
configuration,
undefined,
location ? vscode.Uri.joinPath(location, resourceTreeEntity.CodeUri ?? '').fsPath : undefined
)
} catch (error: any) {
getLogger().error('Error getting Lambda configuration: %O', error)
throw ToolkitError.chain(error, 'Error getting Lambda configuration', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export class ResourceNode implements TreeNode {
this.deployedResource,
this.region,
this.stackName,
this.resourceTreeEntity
this.resourceTreeEntity,
this.location.projectRoot
)
}
if (this.resourceTreeEntity.Type === SERVERLESS_FUNCTION_TYPE) {
Expand Down
17 changes: 11 additions & 6 deletions packages/core/src/awsService/appBuilder/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,19 +569,24 @@ export async function getLambdaHandlerFile(
})
}

// if this function is used to get handler from a just downloaded lambda function zip. codeUri will be ''
if (codeUri !== '') {
folderUri = vscode.Uri.joinPath(folderUri, codeUri)
}

const handlerParts = handler.split('.')
// sample: app.lambda_handler -> app.rb
if (family === RuntimeFamily.Ruby) {
// Ruby supports namespace/class handlers as well, but the path is
// guaranteed to be slash-delimited so we can assume the first part is
// the path
return vscode.Uri.joinPath(folderUri, codeUri, handlerParts.slice(0, handlerParts.length - 1).join('/') + '.rb')
return vscode.Uri.joinPath(folderUri, handlerParts.slice(0, handlerParts.length - 1).join('/') + '.rb')
}

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

// sample: app.handler -> app.mjs/app.js
Expand All @@ -591,23 +596,23 @@ export async function getLambdaHandlerFile(
const handlerPath = path.dirname(handlerName)
const handlerFile = path.basename(handlerName)
const pattern = new vscode.RelativePattern(
vscode.Uri.joinPath(folderUri, codeUri, handlerPath),
`${handlerFile}.{js,mjs}`
vscode.Uri.joinPath(folderUri, handlerPath),
`${handlerFile}.{js,mjs,cjs,ts}`
)
return searchHandlerFile(folderUri, pattern)
}
// search directly under Code uri for Dotnet and java
// sample: ImageResize::ImageResize.Function::FunctionHandler -> Function.cs
if (family === RuntimeFamily.DotNet) {
const handlerName = path.basename(handler.split('::')[1].replaceAll('.', '/'))
const pattern = new vscode.RelativePattern(vscode.Uri.joinPath(folderUri, codeUri), `${handlerName}.cs`)
const pattern = new vscode.RelativePattern(folderUri, `${handlerName}.cs`)
return searchHandlerFile(folderUri, pattern)
}

// sample: resizer.App::handleRequest -> App.java
if (family === RuntimeFamily.Java) {
const handlerName = handler.split('::')[0].replaceAll('.', '/')
const pattern = new vscode.RelativePattern(vscode.Uri.joinPath(folderUri, codeUri), `**/${handlerName}.java`)
const pattern = new vscode.RelativePattern(folderUri, `**/${handlerName}.java`)
return searchHandlerFile(folderUri, pattern)
}
}
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/lambda/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { uploadLambdaCommand } from './commands/uploadLambda'
import { LambdaFunctionNode } from './explorer/lambdaFunctionNode'
import { downloadLambdaCommand, openLambdaFile } from './commands/downloadLambda'
import { tryRemoveFolder } from '../shared/filesystemUtilities'
import { ExtContext } from '../shared/extensions'
import { invokeRemoteLambda } from './vue/remoteInvoke/invokeLambda'
import { registerSamDebugInvokeVueCommand, registerSamInvokeVueCommand } from './vue/configEditor/samInvokeBackend'
import { Commands } from '../shared/vscode/commands2'
Expand Down Expand Up @@ -42,6 +41,8 @@ import { registerLambdaUriHandler } from './uriHandlers'
import globals from '../shared/extensionGlobals'

const localize = nls.loadMessageBundle()
import { activateRemoteDebugging } from './remoteDebugging/ldkController'
import { ExtContext } from '../shared/extensions'

async function openReadme() {
const readmeUri = vscode.Uri.file(await getReadme())
Expand Down Expand Up @@ -263,4 +264,6 @@ export async function activate(context: ExtContext): Promise<void> {

registerLambdaUriHandler()
)

void activateRemoteDebugging()
}
Loading
Loading