Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix output channel interrupt #1174

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/espIdf/serial/serialPort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { LocDictionary } from "../../localizationDictionary";
import { Logger } from "../../logger/logger";
import { spawn } from "../../utils";
import { SerialPortDetails } from "./serialPortDetails";
import { OutputChannel } from "../../logger/outputChannel";

export class SerialPort {
public static shared(): SerialPort {
Expand Down Expand Up @@ -63,10 +64,15 @@ export class SerialPort {
await this.updatePortListStatus(chosen.label, workspaceFolder);
}
} catch (error) {
const msg = error.message
? error.message
: "Something went wrong while getting the serial port list";
Logger.errorNotify(
"Something went wrong while getting the serial port list",
msg,
error
);
OutputChannel.appendLine(msg, "Serial port");
OutputChannel.appendLineAndShow(JSON.stringify(error));
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3735,6 +3735,9 @@ const flash = (
) as ESP.FlashType;
}
await startFlashing(cancelToken, flashType, encryptPartition);
OutputChannel.appendLine(
"Flash has finished. You can monitor with ESP-IDF: Monitor your device command"
);
}
);
});
Expand Down
12 changes: 9 additions & 3 deletions src/logger/outputChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@ export class OutputChannel {

public static appendLine(message: string, name?: string) {
OutputChannel.checkInitialized();
if(name) {
if (name && this.lastTag !== name) {
if (this.lastTag) {
OutputChannel.instance.appendLine(`[/${this.lastTag}]`);
}
OutputChannel.instance.appendLine(`[${name}]`);
this.lastTag = name;
}
OutputChannel.instance.appendLine(message);
}

public static append(message: string, name?: string) {
OutputChannel.checkInitialized();
if(name) {
if (name) {
OutputChannel.instance.appendLine(`[${name}]`);
}
}
OutputChannel.instance.append(message);
}

Expand All @@ -58,6 +62,8 @@ export class OutputChannel {

private static instance: vscode.OutputChannel;

private static lastTag: string;

private static checkInitialized() {
if (!OutputChannel.instance) {
throw new Error(
Expand Down
Loading