Skip to content

Commit

Permalink
[VSC-1412] Add validation for debug session status for monitor start …
Browse files Browse the repository at this point in the history
…with no reset flag (#1270)

* Add validation for debug session status

* Made function static
  • Loading branch information
radurentea authored Oct 25, 2024
1 parent 11532cb commit 608a45e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/espIdf/monitor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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") {
Expand Down Expand Up @@ -144,4 +147,8 @@ export class IDFMonitor {
this.terminal.sendText(`exit`);
} catch (error) {}
}

private static isDebugSessionActive(): boolean {
return debug.activeDebugSession !== undefined;
}
}

0 comments on commit 608a45e

Please sign in to comment.