Skip to content

Commit deadc5a

Browse files
committed
add checkbox
1 parent dc43ad2 commit deadc5a

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,25 @@ export class SamInvokeWebview extends VueWebview {
348348
* Validate and execute the provided launch config.
349349
* TODO: Post validation failures back to webview?
350350
* @param config Config to invoke
351+
* @param source Source of the invoke request
352+
* @param useDebugger Whether to invoke with debugger attached
351353
*/
352-
public async invokeLaunchConfig(config: AwsSamDebuggerConfiguration, source?: string): Promise<void> {
354+
public async invokeLaunchConfig(
355+
config: AwsSamDebuggerConfiguration,
356+
source?: string,
357+
useDebugger: boolean = true
358+
): Promise<void> {
353359
const finalConfig = finalizeConfig(
354360
resolveWorkspaceFolderVariable(undefined, config),
355361
'Editor-Created Debug Config'
356362
)
357363
const targetUri = await this.getUriFromLaunchConfig(finalConfig)
358364
const folder = targetUri ? vscode.workspace.getWorkspaceFolder(targetUri) : undefined
359365

360-
// startDebugging on VS Code goes through the whole resolution chain
361-
await vscode.debug.startDebugging(folder, finalConfig)
366+
// Use the existing startDebugging method with the noDebug option
367+
await vscode.debug.startDebugging(folder, finalConfig, {
368+
noDebug: !useDebugger,
369+
})
362370
}
363371
public async getLaunchConfigQuickPickItems(
364372
launchConfig: LaunchConfiguration,

packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@
139139
</select>
140140
<span class="data-view">runtime in data: {{ launchConfig.lambda.runtime }}</span>
141141
</div>
142+
<div class="config-item">
143+
<label for="useDebugger">Attach a debugger</label>
144+
<input type="checkbox" id="useDebugger" v-model="useDebugger" name="useDebugger" />
145+
</div>
142146
</div>
143147
<div class="target-template" v-else-if="launchConfig.invokeTarget.target === 'template'">
144148
<div class="config-item">
@@ -195,6 +199,10 @@
195199
For invoke the runtime defined in the template is used.
196200
</p>
197201
</div>
202+
<div class="config-item">
203+
<label for="useDebugger">Attach a debugger</label>
204+
<input type="checkbox" id="useDebugger" v-model="useDebugger" name="useDebugger" />
205+
</div>
198206
</div>
199207
<div class="target-apigw" v-else-if="launchConfig.invokeTarget.target === 'api'">
200208
<button v-on:click.prevent="loadResource">Load resource</button><br />
@@ -229,6 +237,10 @@
229237
</select>
230238
<span class="data-view">runtime in data: {{ launchConfig.lambda.runtime }}</span>
231239
</div>
240+
<div class="config-item">
241+
<label for="useDebugger">Attach a debugger</label>
242+
<input type="checkbox" id="useDebugger" v-model="useDebugger" name="useDebugger" />
243+
</div>
232244
<div class="config-item">
233245
<label for="path">Path</label>
234246
<input type="text" v-model="launchConfig.api.path" />

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ interface SamInvokeVueData {
4848
showNameInput: boolean
4949
newTestEventName: string
5050
resourceData: ResourceData | undefined
51+
useDebugger: boolean
5152
}
5253

5354
function newLaunchConfig(existingConfig?: AwsSamDebuggerConfiguration): AwsSamDebuggerConfigurationLoose {
@@ -112,6 +113,7 @@ function initData() {
112113
return {
113114
containerBuild: false,
114115
skipNewImageCheck: false,
116+
useDebugger: true,
115117
launchConfig: newLaunchConfig(),
116118
payload: { value: '', errorMsg: '' },
117119
apiPayload: { value: '', errorMsg: '' },
@@ -170,7 +172,7 @@ export default defineComponent({
170172

171173
const source = this.resourceData?.source
172174

173-
client.invokeLaunchConfig(config, source).catch((e: Error) => {
175+
client.invokeLaunchConfig(config, source, this.useDebugger).catch((e: Error) => {
174176
console.error(`invokeLaunchConfig failed: ${e.message}`)
175177
})
176178
},

0 commit comments

Comments
 (0)