Add print_rich() support to Debug Console (#792)

* add bbcode support to debug console
* fix output line for Debug Console
* Update debug console output. Add Godot3.6 support.
This commit is contained in:
Saint
2025-02-22 12:36:11 -05:00
committed by GitHub
parent b986ce0e51
commit b29fbb75a0
4 changed files with 17 additions and 6 deletions

6
package-lock.json generated
View File

@@ -12,6 +12,7 @@
"@vscode/debugadapter": "^1.68.0",
"@vscode/debugprotocol": "^1.68.0",
"await-notify": "^1.0.1",
"bbcode-to-ansi": "^1.0.0",
"global": "^4.4.0",
"marked": "^4.0.11",
"net": "^1.0.2",
@@ -2129,6 +2130,11 @@
],
"optional": true
},
"node_modules/bbcode-to-ansi": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/bbcode-to-ansi/-/bbcode-to-ansi-1.0.0.tgz",
"integrity": "sha512-YQVaDdsVP2590q2AD3oTuSQecpx3YF2+gAimSbbmdjdvI8O8AOmEiTRLiRa1l2UoKjmbNh4e20s4XlRLk2n7ww=="
},
"node_modules/binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",

View File

@@ -901,6 +901,7 @@
"@vscode/debugadapter": "^1.68.0",
"@vscode/debugprotocol": "^1.68.0",
"await-notify": "^1.0.1",
"bbcode-to-ansi": "^1.0.0",
"global": "^4.4.0",
"marked": "^4.0.11",
"net": "^1.0.2",

View File

@@ -23,9 +23,12 @@ import { build_sub_values, parse_next_scene_node, split_buffers } from "./helper
import { VariantDecoder } from "./variables/variant_decoder";
import { VariantEncoder } from "./variables/variant_encoder";
import { RawObject } from "./variables/variants";
import BBCodeToAnsi from 'bbcode-to-ansi';
const log = createLogger("debugger.controller", { output: "Godot Debugger" });
const socketLog = createLogger("debugger.socket");
//initialize bbcodeParser and set default output color to grey
const bbcodeParser = new BBCodeToAnsi("\u001b[38;2;211;211;211m");
class Command {
public command: string = "";
@@ -427,9 +430,8 @@ export class ServerController {
this.didFirstOutput = true;
// this.request_scene_tree();
}
const lines = command.parameters;
for (const line of lines) {
debug.activeDebugConsole.appendLine(ansi.bright.blue + line[0]);
for (const output of command.parameters){
output[0].split("\n").forEach(line => debug.activeDebugConsole.appendLine(bbcodeParser.parse(line)));
}
break;
}

View File

@@ -24,9 +24,12 @@ import { VariantDecoder } from "./variables/variant_decoder";
import { VariantEncoder } from "./variables/variant_encoder";
import { RawObject } from "./variables/variants";
import { VariablesManager } from "./variables/variables_manager";
import BBCodeToAnsi from 'bbcode-to-ansi';
const log = createLogger("debugger.controller", { output: "Godot Debugger" });
const socketLog = createLogger("debugger.socket");
//initialize bbcodeParser and set default output color to grey
const bbcodeParser = new BBCodeToAnsi("\u001b[38;2;211;211;211m");
class Command {
public command: string = "";
@@ -529,9 +532,8 @@ export class ServerController {
this.didFirstOutput = true;
// this.request_scene_tree();
}
const lines = command.parameters[0];
for (const line of lines) {
debug.activeDebugConsole.appendLine(ansi.bright.blue + line);
for (const output of command.parameters[0]){
output.split("\n").forEach(line => debug.activeDebugConsole.appendLine(bbcodeParser.parse(line)));
}
break;
}