From 9c7161d6910e824609e10237f6dd61c3f9e7fa14 Mon Sep 17 00:00:00 2001 From: Radu Date: Fri, 2 Aug 2024 13:33:18 +0300 Subject: [PATCH 1/2] Add validation for debug session status --- src/espIdf/monitor/index.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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; + } } From 0d43dc58d2f7a63656f89ac22fa8c0b8a3fab92c Mon Sep 17 00:00:00 2001 From: Radu Date: Wed, 23 Oct 2024 14:41:04 +0200 Subject: [PATCH 2/2] Made function static --- src/espIdf/monitor/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/espIdf/monitor/index.ts b/src/espIdf/monitor/index.ts index 7c55894df..07ceb9d43 100644 --- a/src/espIdf/monitor/index.ts +++ b/src/espIdf/monitor/index.ts @@ -148,7 +148,7 @@ export class IDFMonitor { } catch (error) {} } - private isDebugSessionActive(): boolean { + private static isDebugSessionActive(): boolean { return debug.activeDebugSession !== undefined; } }