Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 11 additions & 3 deletions packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,17 +348,25 @@ 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<void> {
public async invokeLaunchConfig(
config: AwsSamDebuggerConfiguration,
source?: string,
useDebugger: boolean = true
): Promise<void> {
const finalConfig = finalizeConfig(
resolveWorkspaceFolderVariable(undefined, config),
'Editor-Created Debug Config'
)
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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? This is already supported by the existing (inherited from vscode) noDebug field:

//
// Debug properties (when user runs with debugging enabled).
//
/** vscode implicit field, set if user invokes "Run (Start Without Debugging)". */
noDebug?: boolean

})
}
public async getLaunchConfigQuickPickItems(
launchConfig: LaunchConfiguration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@
</select>
<span class="data-view">runtime in data: {{ launchConfig.lambda.runtime }}</span>
</div>
<div class="config-item">
<label for="useDebugger">Attach a debugger</label>
<input type="checkbox" id="useDebugger" v-model="useDebugger" name="useDebugger" />
</div>
</div>
<div class="target-template" v-else-if="launchConfig.invokeTarget.target === 'template'">
<div class="config-item">
Expand Down Expand Up @@ -195,6 +199,10 @@
For invoke the runtime defined in the template is used.
</p>
</div>
<div class="config-item">
<label for="useDebugger">Attach a debugger</label>
<input type="checkbox" id="useDebugger" v-model="useDebugger" name="useDebugger" />
</div>
</div>
<div class="target-apigw" v-else-if="launchConfig.invokeTarget.target === 'api'">
<button v-on:click.prevent="loadResource">Load resource</button><br />
Expand Down Expand Up @@ -229,6 +237,10 @@
</select>
<span class="data-view">runtime in data: {{ launchConfig.lambda.runtime }}</span>
</div>
<div class="config-item">
<label for="useDebugger">Attach a debugger</label>
<input type="checkbox" id="useDebugger" v-model="useDebugger" name="useDebugger" />
</div>
<div class="config-item">
<label for="path">Path</label>
<input type="text" v-model="launchConfig.api.path" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface SamInvokeVueData {
showNameInput: boolean
newTestEventName: string
resourceData: ResourceData | undefined
useDebugger: boolean
Copy link
Contributor

@justinmk3 justinmk3 Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this probably isn't needed either, because launchConfig on line 33 should already have noDebug field.

oh but if this is "binding" to the vue, maybe this is needed easier/clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is binding to the vue.

}

function newLaunchConfig(existingConfig?: AwsSamDebuggerConfiguration): AwsSamDebuggerConfigurationLoose {
Expand Down Expand Up @@ -112,6 +113,7 @@ function initData() {
return {
containerBuild: false,
skipNewImageCheck: false,
useDebugger: true,
launchConfig: newLaunchConfig(),
payload: { value: '', errorMsg: '' },
apiPayload: { value: '', errorMsg: '' },
Expand Down Expand Up @@ -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}`)
})
},
Expand Down
Loading