From cb19255e28b3eb1268142b7b76be20e23ec09c86 Mon Sep 17 00:00:00 2001 From: Francois Belair Date: Tue, 5 May 2020 11:15:47 -0400 Subject: [PATCH] Fix debugger not showing output text Or rather, the output window never got created. Fixes #173 --- src/debugger/mediator.ts | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/debugger/mediator.ts b/src/debugger/mediator.ts index ed76954..5f76f90 100644 --- a/src/debugger/mediator.ts +++ b/src/debugger/mediator.ts @@ -4,8 +4,6 @@ import { GodotDebugSession } from "./debug_session"; import { StoppedEvent, TerminatedEvent } from "vscode-debugadapter"; import { GodotDebugData, GodotVariable } from "./debug_runtime"; -let output: OutputChannel; - export class Mediator { private static controller?: ServerController; private static debug_data?: GodotDebugData; @@ -15,27 +13,24 @@ export class Mediator { > = new Map(); private static session?: GodotDebugSession; private static first_output = false; + private static output: OutputChannel = window.createOutputChannel("Godot"); - private constructor() { - if (!output) { - output = window.createOutputChannel("Godot"); - } else { - output.clear(); - } - } + private constructor() {} public static notify(event: string, parameters: any[] = []) { switch (event) { case "output": - let lines: string[] = parameters; - lines.forEach((line) => { - output?.appendLine(line); - }); - - if(!this.first_output) { + if (!this.first_output) { this.first_output = true; + this.output.show(true); + this.output.clear(); this.controller?.send_request_scene_tree_command(); } + + let lines: string[] = parameters; + lines.forEach((line) => { + this.output.appendLine(line); + }); break; case "continue":