microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.27k stars 28.57k forks source link

LogOutputChannel does not clear all characters of Log Message #224516

Open AnWeber opened 1 month ago

AnWeber commented 1 month ago

Does this issue occur when all extensions are disabled?: Yes

Version: 1.91.1 (system setup) Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729 Date: 2024-07-09T22:06:49.809Z Electron: 29.4.0 ElectronBuildId: 9728852 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Windows_NT x64 10.0.22631

Steps to Reproduce:

  1. Create extensions with code

    export function activate(): void {
    const notClearable = vscode.window.createOutputChannel(`LogOutputChannel`, { log: true });
    
    notClearable.info('my first log message');
    setTimeout(() => {
    notClearable.clear();
    setTimeout(() => {
      notClearable.info('my second log message');
    }, 4000);
    }, 4000);
    }
  2. start extension

After 8000ms LogOutputChannel should only have one message my second log message in the channel. Instead it contains some remaining chars of the first log message.

log_not_cleared

c3danielxu commented 1 month ago

I am running into the same issue as well. After calling clear on a LogOutputChannel, when the next message is logged, regardless of info/error/debug/etc, part of the previous log is shown.

nhedger commented 3 weeks ago

It is possibly a duplicate of my previous issue, https://github.com/microsoft/vscode/issues/204946, which I believe was closed prematurely.