Skip to content

Commit 834dd09

Browse files
authored
fix(sam): debug console is focused when debuggin a local lambda #5635
## Problem The IDE force snaps to Debug Console during local lambda build ## Solution Create `showOutputChannel` function to focus the window on output channel
1 parent 7b4257a commit 834dd09

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

packages/core/src/shared/sam/localLambdaRunner.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,11 @@ export async function runLambdaFunction(
347347
debugConfig: config,
348348
retryDelayMillis: attachDebuggerRetryDelayMillis,
349349
})
350-
351-
await showDebugConsole()
352350
}
353351

354352
try {
355353
await attach()
354+
await showOutputChannel(ctx)
356355
} finally {
357356
vscode.Disposable.from(timer, terminationListener).dispose()
358357
}
@@ -536,16 +535,14 @@ export function shouldAppendRelativePathToFuncHandler(runtime: string): boolean
536535
}
537536

538537
/**
539-
* Brings the Debug Console in focus.
540-
* If the OutputChannel is showing, focus does not consistently switch over to the debug console, so we're
541-
* helping make this happen.
538+
* Brings the Output Channel in focus.
542539
*/
543-
async function showDebugConsole(): Promise<void> {
540+
async function showOutputChannel(ctx: ExtContext): Promise<void> {
544541
try {
545-
await vscode.commands.executeCommand('workbench.debug.action.toggleRepl')
542+
ctx.outputChannel.show(true)
546543
} catch (err) {
547544
// in case the vs code command changes or misbehaves, swallow error
548-
getLogger().verbose('Unable to switch to the Debug Console: %O', err as Error)
545+
getLogger().verbose('Unable to focus output channel: %O', err as Error)
549546
}
550547
}
551548

0 commit comments

Comments
 (0)