From deadc5a06c0d653fc2898db436ad65212f8635a6 Mon Sep 17 00:00:00 2001 From: mbfreder Date: Tue, 15 Apr 2025 09:01:39 -0700 Subject: [PATCH 1/3] add checkbox --- .../lambda/vue/configEditor/samInvokeBackend.ts | 14 +++++++++++--- .../lambda/vue/configEditor/samInvokeComponent.vue | 12 ++++++++++++ .../lambda/vue/configEditor/samInvokeFrontend.ts | 4 +++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts b/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts index 2084ebe82fe..fb8467efbc9 100644 --- a/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts +++ b/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts @@ -348,8 +348,14 @@ export class SamInvokeWebview extends VueWebview { * Validate and execute the provided launch config. * TODO: Post validation failures back to webview? * @param config Config to invoke + * @param source Source of the invoke request + * @param useDebugger Whether to invoke with debugger attached */ - public async invokeLaunchConfig(config: AwsSamDebuggerConfiguration, source?: string): Promise { + public async invokeLaunchConfig( + config: AwsSamDebuggerConfiguration, + source?: string, + useDebugger: boolean = true + ): Promise { const finalConfig = finalizeConfig( resolveWorkspaceFolderVariable(undefined, config), 'Editor-Created Debug Config' @@ -357,8 +363,10 @@ export class SamInvokeWebview extends VueWebview { const targetUri = await this.getUriFromLaunchConfig(finalConfig) const folder = targetUri ? vscode.workspace.getWorkspaceFolder(targetUri) : undefined - // startDebugging on VS Code goes through the whole resolution chain - await vscode.debug.startDebugging(folder, finalConfig) + // Use the existing startDebugging method with the noDebug option + await vscode.debug.startDebugging(folder, finalConfig, { + noDebug: !useDebugger, + }) } public async getLaunchConfigQuickPickItems( launchConfig: LaunchConfiguration, diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue b/packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue index 6d64291cff6..e7d09c584c9 100644 --- a/packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue +++ b/packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue @@ -139,6 +139,10 @@ runtime in data: {{ launchConfig.lambda.runtime }} +
+ + +
@@ -195,6 +199,10 @@ For invoke the runtime defined in the template is used.

+
+ + +

@@ -229,6 +237,10 @@ runtime in data: {{ launchConfig.lambda.runtime }}
+
+ + +
diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts b/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts index 6502accae41..05eaed8f8cd 100644 --- a/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts +++ b/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts @@ -48,6 +48,7 @@ interface SamInvokeVueData { showNameInput: boolean newTestEventName: string resourceData: ResourceData | undefined + useDebugger: boolean } function newLaunchConfig(existingConfig?: AwsSamDebuggerConfiguration): AwsSamDebuggerConfigurationLoose { @@ -112,6 +113,7 @@ function initData() { return { containerBuild: false, skipNewImageCheck: false, + useDebugger: true, launchConfig: newLaunchConfig(), payload: { value: '', errorMsg: '' }, apiPayload: { value: '', errorMsg: '' }, @@ -170,7 +172,7 @@ export default defineComponent({ const source = this.resourceData?.source - client.invokeLaunchConfig(config, source).catch((e: Error) => { + client.invokeLaunchConfig(config, source, this.useDebugger).catch((e: Error) => { console.error(`invokeLaunchConfig failed: ${e.message}`) }) }, From 6af4cc7c67168c92d8e562abd8cd5395b5359793 Mon Sep 17 00:00:00 2001 From: mbfreder Date: Tue, 29 Apr 2025 09:27:50 -0700 Subject: [PATCH 2/3] use noDebug field from config --- .../lambda/vue/configEditor/samInvokeBackend.ts | 14 +++----------- .../lambda/vue/configEditor/samInvokeFrontend.ts | 3 ++- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts b/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts index fb8467efbc9..2084ebe82fe 100644 --- a/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts +++ b/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts @@ -348,14 +348,8 @@ export class SamInvokeWebview extends VueWebview { * Validate and execute the provided launch config. * TODO: Post validation failures back to webview? * @param config Config to invoke - * @param source Source of the invoke request - * @param useDebugger Whether to invoke with debugger attached */ - public async invokeLaunchConfig( - config: AwsSamDebuggerConfiguration, - source?: string, - useDebugger: boolean = true - ): Promise { + public async invokeLaunchConfig(config: AwsSamDebuggerConfiguration, source?: string): Promise { const finalConfig = finalizeConfig( resolveWorkspaceFolderVariable(undefined, config), 'Editor-Created Debug Config' @@ -363,10 +357,8 @@ export class SamInvokeWebview extends VueWebview { const targetUri = await this.getUriFromLaunchConfig(finalConfig) const folder = targetUri ? vscode.workspace.getWorkspaceFolder(targetUri) : undefined - // Use the existing startDebugging method with the noDebug option - await vscode.debug.startDebugging(folder, finalConfig, { - noDebug: !useDebugger, - }) + // startDebugging on VS Code goes through the whole resolution chain + await vscode.debug.startDebugging(folder, finalConfig) } public async getLaunchConfigQuickPickItems( launchConfig: LaunchConfiguration, diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts b/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts index 05eaed8f8cd..375e22f4878 100644 --- a/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts +++ b/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts @@ -172,7 +172,7 @@ export default defineComponent({ const source = this.resourceData?.source - client.invokeLaunchConfig(config, source, this.useDebugger).catch((e: Error) => { + client.invokeLaunchConfig(config, source).catch((e: Error) => { console.error(`invokeLaunchConfig failed: ${e.message}`) }) }, @@ -451,6 +451,7 @@ export default defineComponent({ }, } : undefined, + noDebug: !this.useDebugger, } }, clearForm() { From 180b39d7567b7da8b7add360b14f5da359d7cc7a Mon Sep 17 00:00:00 2001 From: mbfreder Date: Tue, 29 Apr 2025 09:48:45 -0700 Subject: [PATCH 3/3] add changelog --- .../Feature-b9357975-bda4-4ec8-a8ea-d955708b7596.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 packages/toolkit/.changes/next-release/Feature-b9357975-bda4-4ec8-a8ea-d955708b7596.json diff --git a/packages/toolkit/.changes/next-release/Feature-b9357975-bda4-4ec8-a8ea-d955708b7596.json b/packages/toolkit/.changes/next-release/Feature-b9357975-bda4-4ec8-a8ea-d955708b7596.json new file mode 100644 index 00000000000..1d7f7fe17ca --- /dev/null +++ b/packages/toolkit/.changes/next-release/Feature-b9357975-bda4-4ec8-a8ea-d955708b7596.json @@ -0,0 +1,4 @@ +{ + "type": "Feature", + "description": "AppBuilder: unchecking the 'Attach a debugger' checkbox in local invoke webview invokes the function without a debugger" +}