From 59c2a4b31b084415b502a55bd94b3377bc35087e Mon Sep 17 00:00:00 2001 From: Christopher Dwyer-Perkins Date: Thu, 21 Nov 2024 22:13:58 -0400 Subject: [PATCH 1/5] Fixed volume up command --- src/BrightScriptCommands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BrightScriptCommands.ts b/src/BrightScriptCommands.ts index 28772369..860a55dc 100644 --- a/src/BrightScriptCommands.ts +++ b/src/BrightScriptCommands.ts @@ -177,7 +177,7 @@ export class BrightScriptCommands { }); this.registerCommand('pressVolumeUp', async () => { - await this.sendRemoteCommand('FindVolumeUp'); + await this.sendRemoteCommand('VolumeUp'); }); this.registerCommand('pressPowerOff', async () => { From aeacb6f686416a8f959c55d2cea698d5b6a35c8f Mon Sep 17 00:00:00 2001 From: Christopher Dwyer-Perkins Date: Thu, 21 Nov 2024 22:14:49 -0400 Subject: [PATCH 2/5] Added new set volume command --- package.json | 7 +++++++ src/BrightScriptCommands.ts | 40 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/package.json b/package.json index e8b516bd..a8b3a5c7 100644 --- a/package.json +++ b/package.json @@ -177,6 +177,7 @@ "onCommand:extension.brightscript.pressVolumeDown", "onCommand:extension.brightscript.pressVolumeMute", "onCommand:extension.brightscript.pressVolumeUp", + "onCommand:extension.brightscript.setVolume", "onCommand:extension.brightscript.pressPowerOff", "onCommand:extension.brightscript.pressChannelUp", "onCommand:extension.brightscript.pressChannelDown", @@ -2857,6 +2858,12 @@ "title": "Press the VolumeUp button on the Roku remote", "category": "Brightscript" }, + { + "command": "extension.brightscript.setVolume", + "title": "Set a target volume level by repeatedly pressing VolumeDown followed by VolumeUp buttons on the Roku remote", + "shortTitle": "Set Volume target volume level", + "category": "Brightscript" + }, { "command": "extension.brightscript.pressPowerOff", "title": "Press the PowerOff button on the Roku remote", diff --git a/src/BrightScriptCommands.ts b/src/BrightScriptCommands.ts index 860a55dc..c19b93c3 100644 --- a/src/BrightScriptCommands.ts +++ b/src/BrightScriptCommands.ts @@ -180,6 +180,46 @@ export class BrightScriptCommands { await this.sendRemoteCommand('VolumeUp'); }); + this.registerCommand('setVolume', async () => { + let result = await vscode.window.showInputBox({ + placeHolder: 'The target volume level (0-100)', + value: '', + validateInput: (text: string) => { + const num = Number(text); + if (isNaN(num)) { + return 'Value must be a number'; + } else if (num < 0 || num > 100) { + return 'Please enter a number between 0 and 100'; + } + return null; + } + }); + const targetVolume = Number(result); + + if (!isNaN(targetVolume)) { + await vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: 'Setting volume' + }, async (progress) => { + const totalCommands = 100 + targetVolume; + const incrementValue = 100 / totalCommands; + let executedCommands = 0; + + for (let i = 0; i < 100; i++) { + await this.sendRemoteCommand('VolumeDown'); + executedCommands++; + progress.report({ increment: incrementValue, message: `decreasing volume - ${Math.round((executedCommands / totalCommands) * 100)}%` }); + } + + for (let i = 0; i < targetVolume; i++) { + await this.sendRemoteCommand('VolumeUp'); + executedCommands++; + progress.report({ increment: incrementValue, message: `increasing volume - ${Math.round((executedCommands / totalCommands) * 100)}%` }); + } + }); + } + }); + this.registerCommand('pressPowerOff', async () => { await this.sendRemoteCommand('PowerOff'); }); From 839f5b30396dc9596e71061552113ef57e984c06 Mon Sep 17 00:00:00 2001 From: Christopher Dwyer-Perkins Date: Thu, 21 Nov 2024 22:15:47 -0400 Subject: [PATCH 3/5] Added blue, green, red, yellow, and exit button commands --- package.json | 30 ++++++++++++++++++++++++++++++ src/BrightScriptCommands.ts | 20 ++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/package.json b/package.json index a8b3a5c7..2e99e53b 100644 --- a/package.json +++ b/package.json @@ -181,6 +181,11 @@ "onCommand:extension.brightscript.pressPowerOff", "onCommand:extension.brightscript.pressChannelUp", "onCommand:extension.brightscript.pressChannelDown", + "onCommand:extension.brightscript.pressBlue", + "onCommand:extension.brightscript.pressGreen", + "onCommand:extension.brightscript.pressRed", + "onCommand:extension.brightscript.pressYellow", + "onCommand:extension.brightscript.pressExit", "onCommand:extension.brightscript.changeTvInput", "onCommand:extension.brightscript.sendRemoteText", "onCommand:brighterscript.showPreview", @@ -2884,6 +2889,31 @@ "title": "Press the ChannelDown button on the Roku remote", "category": "Brightscript" }, + { + "command": "extension.brightscript.pressBlue", + "title": "Press the Blue button on the Roku remote", + "category": "Brightscript" + }, + { + "command": "extension.brightscript.pressGreen", + "title": "Press the Green button on the Roku remote", + "category": "Brightscript" + }, + { + "command": "extension.brightscript.pressRed", + "title": "Press the Red button on the Roku remote", + "category": "Brightscript" + }, + { + "command": "extension.brightscript.pressYellow", + "title": "Press the Yellow button on the Roku remote", + "category": "Brightscript" + }, + { + "command": "extension.brightscript.pressExit", + "title": "Press the Exit button on the Roku remote", + "category": "Brightscript" + }, { "command": "extension.brightscript.changeTvInput", "title": "Provides a list of possible inputs to change to", diff --git a/src/BrightScriptCommands.ts b/src/BrightScriptCommands.ts index c19b93c3..da85f028 100644 --- a/src/BrightScriptCommands.ts +++ b/src/BrightScriptCommands.ts @@ -236,6 +236,26 @@ export class BrightScriptCommands { await this.sendRemoteCommand('ChannelDown'); }); + this.registerCommand('pressBlue', async () => { + await this.sendRemoteCommand('Blue'); + }); + + this.registerCommand('pressGreen', async () => { + await this.sendRemoteCommand('Green'); + }); + + this.registerCommand('pressRed', async () => { + await this.sendRemoteCommand('Red'); + }); + + this.registerCommand('pressYellow', async () => { + await this.sendRemoteCommand('Yellow'); + }); + + this.registerCommand('pressExit', async () => { + await this.sendRemoteCommand('Exit'); + }); + this.registerCommand('changeTvInput', async (host?: string) => { const selectedInput = await vscode.window.showQuickPick([ 'InputHDMI1', From ff3676154cd77a2b9e8b62f97c57867f4865d337 Mon Sep 17 00:00:00 2001 From: Christopher Dwyer-Perkins Date: Mon, 13 Jan 2025 11:23:07 -0400 Subject: [PATCH 4/5] Fixed some newline bugs and rendering issues with asci chars --- package-lock.json | 196 ++++++++++++++++++++++++++++++++++++++-- package.json | 1 + src/LogOutputManager.ts | 11 ++- 3 files changed, 198 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index fea500f0..c9607026 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,6 +42,7 @@ "roku-test-automation": "^2.0.10", "semver": "^7.1.3", "source-map": "^0.7.3", + "strip-ansi": "^5.2.0", "thenby": "^1.3.4", "undent": "^0.1.0", "uuid": "^9.0.1", @@ -2368,11 +2369,11 @@ } }, "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", "engines": { - "node": ">=8" + "node": ">=6" } }, "node_modules/ansi-styles": { @@ -2884,6 +2885,14 @@ "bsfmt": "dist/cli.js" } }, + "node_modules/brighterscript-formatter/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/brighterscript-formatter/node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -2928,6 +2937,17 @@ "node": ">=8" } }, + "node_modules/brighterscript-formatter/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/brighterscript-formatter/node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", @@ -3440,6 +3460,14 @@ "wrap-ansi": "^7.0.0" } }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/cliui/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -3466,6 +3494,17 @@ "node": ">=8" } }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/clone": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", @@ -4820,6 +4859,15 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/eslint/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/eslint/node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -4895,6 +4943,18 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/eslint/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/esniff": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/esniff/-/esniff-2.0.1.tgz", @@ -5742,6 +5802,14 @@ "glob-all": "bin/glob-all" } }, + "node_modules/glob-all/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/glob-all/node_modules/cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", @@ -5826,6 +5894,17 @@ "node": ">=8" } }, + "node_modules/glob-all/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/glob-all/node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -8010,6 +8089,15 @@ "node": ">=8.9" } }, + "node_modules/nyc/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/nyc/node_modules/cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", @@ -8111,6 +8199,18 @@ "node": ">=8" } }, + "node_modules/nyc/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/nyc/node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -9137,6 +9237,14 @@ "node": ">=10" } }, + "node_modules/replace-in-file/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/replace-in-file/node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -9176,6 +9284,17 @@ "node": ">=8" } }, + "node_modules/replace-in-file/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/replace-in-file/node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", @@ -10071,6 +10190,15 @@ "statigen": "dist/cli.js" } }, + "node_modules/statigen/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/statigen/node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -10140,6 +10268,18 @@ "node": ">=8" } }, + "node_modules/statigen/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/statigen/node_modules/universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", @@ -10326,14 +10466,14 @@ } }, "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dependencies": { - "ansi-regex": "^5.0.1" + "ansi-regex": "^4.1.0" }, "engines": { - "node": ">=8" + "node": ">=6" } }, "node_modules/strip-bom": { @@ -11384,6 +11524,14 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/wrap-ansi/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -11410,6 +11558,17 @@ "node": ">=8" } }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -11542,6 +11701,14 @@ "node": ">=8" } }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/yargs/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -11568,6 +11735,17 @@ "node": ">=8" } }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", diff --git a/package.json b/package.json index 841c9da0..92c5d140 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "roku-test-automation": "^2.0.10", "semver": "^7.1.3", "source-map": "^0.7.3", + "strip-ansi": "^5.2.0", "thenby": "^1.3.4", "undent": "^0.1.0", "uuid": "^9.0.1", diff --git a/src/LogOutputManager.ts b/src/LogOutputManager.ts index 1fdb06f5..c41dae24 100644 --- a/src/LogOutputManager.ts +++ b/src/LogOutputManager.ts @@ -5,6 +5,7 @@ import type { LogDocumentLinkProvider } from './LogDocumentLinkProvider'; import { CustomDocumentLink } from './LogDocumentLinkProvider'; import * as fsExtra from 'fs-extra'; import type { BrightScriptLaunchConfiguration } from './DebugConfigurationProvider'; +import stripAnsi from 'strip-ansi'; export class LogLine { constructor( @@ -258,6 +259,12 @@ export class LogOutputManager { */ public appendLine(lineText: string, mustInclude = false): void { let lines = lineText.split(/\r?\n/g); + + // Remove then last line if it's empty as a result of a trailing newline + if (lines[lines.length - 1] === '') { + lines.pop(); + } + for (let line of lines) { if (line !== '') { if (!this.includeStackTraces) { @@ -284,7 +291,9 @@ export class LogOutputManager { } } } - if (line) { + if (typeof line === 'string') { + // Strip ANSI color codes + line = stripAnsi(line); const logLine = new LogLine(line, mustInclude); this.allLogLines.push(logLine); if (this.shouldLineBeShown(logLine)) { From 23948e151f6e08614ac4782bb1356d22afda444f Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Mon, 13 Jan 2025 10:25:37 -0500 Subject: [PATCH 5/5] Update src/LogOutputManager.ts --- src/LogOutputManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LogOutputManager.ts b/src/LogOutputManager.ts index c41dae24..8f00b230 100644 --- a/src/LogOutputManager.ts +++ b/src/LogOutputManager.ts @@ -260,7 +260,7 @@ export class LogOutputManager { public appendLine(lineText: string, mustInclude = false): void { let lines = lineText.split(/\r?\n/g); - // Remove then last line if it's empty as a result of a trailing newline + // Remove the last line if it's empty as a result of a trailing newline if (lines[lines.length - 1] === '') { lines.pop(); }