diff --git a/src/espIdf/monitor/index.ts b/src/espIdf/monitor/index.ts index 91c523533..7c55894df 100644 --- a/src/espIdf/monitor/index.ts +++ b/src/espIdf/monitor/index.ts @@ -18,7 +18,7 @@ import { ESP } from "../../config"; import { appendIdfAndToolsToPath, getUserShell } from "../../utils"; -import { window, Terminal, Uri, env } from "vscode"; +import { window, Terminal, Uri, env, debug } from "vscode"; export interface MonitorConfig { baudRate: string; @@ -97,7 +97,10 @@ export class IDFMonitor { "--toolchain-prefix", this.config.toolchainPrefix, ]; - if (this.config.noReset && this.config.idfVersion >= "5.0") { + if ( + this.isDebugSessionActive() || + (this.config.noReset && this.config.idfVersion >= "5.0") + ) { args.splice(2, 0, "--no-reset"); } if (this.config.enableTimestamps && this.config.idfVersion >= "4.4") { @@ -144,4 +147,8 @@ export class IDFMonitor { this.terminal.sendText(`exit`); } catch (error) {} } + + private isDebugSessionActive(): boolean { + return debug.activeDebugSession !== undefined; + } }