Skip to content

Commit 53f858b

Browse files
authored
feat(lambda): autoload debug config when Local Invoke view is opened #6583
## Problem Users have to re-select a debug config every time when open the Invoke and Debug webview ## Solution Automatically load the first matching debug configuration when the local invoke view is opened
1 parent 4fe5168 commit 53f858b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
AwsSamDebuggerConfiguration,
1414
isCodeTargetProperties,
1515
isTemplateTargetProperties,
16+
TemplateTargetProperties,
1617
} from '../../../shared/sam/debugger/awsSamDebugConfiguration'
1718
import {
1819
DefaultAwsSamDebugConfigurationValidator,
@@ -433,15 +434,19 @@ export async function registerSamDebugInvokeVueCommand(
433434
context: vscode.ExtensionContext,
434435
params: { resource: ResourceNode }
435436
) {
436-
const launchConfig: AwsSamDebuggerConfiguration | undefined = undefined
437437
const resource = params?.resource.resource
438438
const source = 'AppBuilderLocalInvoke'
439+
const launchConfigs = await new LaunchConfiguration(resource.location).getSamDebugConfigurations()
440+
const launchConfig = launchConfigs.find(
441+
(config) => (config.invokeTarget as TemplateTargetProperties).logicalId === resource.resource.Id
442+
)
443+
439444
const webview = new WebviewPanel(context, launchConfig, {
440445
logicalId: resource.resource.Id ?? '',
441446
region: resource.region ?? '',
442447
location: resource.location.fsPath,
443448
handler: resource.resource.Handler!,
444-
runtime: resource.resource.Runtime!,
449+
runtime: launchConfig?.lambda?.runtime ?? resource.resource.Runtime!,
445450
arn: resource.functionArn ?? '',
446451
stackName: resource.stackName ?? '',
447452
environment: resource.resource.Environment,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "App Builder: Autoload debug configuration for local invoke webview"
4+
}

0 commit comments

Comments
 (0)