From 9f58704b19cd681a177042822008c34825b382a4 Mon Sep 17 00:00:00 2001 From: Brian Ignacio Date: Mon, 1 Apr 2024 18:28:16 +0800 Subject: [PATCH] fix output channel interrupt --- src/espIdf/serial/serialPort.ts | 8 +++++++- src/extension.ts | 3 +++ src/logger/outputChannel.ts | 12 +++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/espIdf/serial/serialPort.ts b/src/espIdf/serial/serialPort.ts index c838d819c..972e03203 100644 --- a/src/espIdf/serial/serialPort.ts +++ b/src/espIdf/serial/serialPort.ts @@ -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 { @@ -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)); } } diff --git a/src/extension.ts b/src/extension.ts index 9fd3335e5..18c2e703b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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" + ); } ); }); diff --git a/src/logger/outputChannel.ts b/src/logger/outputChannel.ts index 22e1d51b6..fb83aadf9 100644 --- a/src/logger/outputChannel.ts +++ b/src/logger/outputChannel.ts @@ -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); } @@ -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(