• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rokucommunity / vscode-brightscript-language / 31214747864

07 Aug 2026 08:11PM UTC coverage: 64.351% (+4.5%) from 59.875%
31214747864

push

github

web-flow
Roku Cloud Emulator support (#861)

3360 of 5629 branches covered (59.69%)

Branch coverage included in aggregate %.

1160 of 1375 new or added lines in 27 files covered. (84.36%)

3 existing lines in 3 files now uncovered.

5025 of 7401 relevant lines covered (67.9%)

47.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

25.4
/src/SceneGraphDebugCommands.ts
1
import * as vscode from 'vscode';
1✔
2
import type { SceneGraphCommandResponse } from 'roku-debug';
3
import { SceneGraphDebugCommandController } from 'roku-debug';
1✔
4
import type { DeviceTargetManager } from './managers/DeviceTargetManager';
5

6
export class SceneGraphDebugCommands {
1✔
7
    private outputChannel: vscode.OutputChannel;
8
    private deviceTargetManager: DeviceTargetManager;
9

10
    public registerCommands(context: vscode.ExtensionContext, outputChannel: vscode.OutputChannel, deviceTargetManager: DeviceTargetManager) {
11
        this.outputChannel = outputChannel;
12✔
12
        this.deviceTargetManager = deviceTargetManager;
12✔
13
        let subscriptions = context.subscriptions;
12✔
14

15
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.bsprofPause', async () => {
12✔
16
            await this.logCommandOutput(async (commandController) => commandController.bsprof('pause'));
×
17
        }));
18

19
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.bsprofResume', async () => {
12✔
20
            await this.logCommandOutput(async (commandController) => commandController.bsprof('resume'));
×
21
        }));
22

23
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.bsprofStatus', async () => {
12✔
24
            await this.logCommandOutput(async (commandController) => commandController.bsprof('status'));
×
25
        }));
26

27
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.chanperf', async () => {
12✔
28
            await this.logCommandOutput(async (commandController) => commandController.chanperf());
×
29
        }));
30

31
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.chanperfChangeInterval', async () => {
12✔
32
            let interval = parseInt(await vscode.window.showInputBox({ placeHolder: 'seconds' }));
×
33
            if (!isNaN(interval)) {
×
34
                await this.logCommandOutput(async (commandController) => commandController.chanperf({ interval: interval }));
×
35
            }
36
        }));
37

38
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.clearLaunchCaches', async () => {
12✔
39
            await this.logCommandOutput(async (commandController) => commandController.clearLaunchCaches());
×
40
        }));
41

42
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.fpsDisplay', async () => {
12✔
43
            let option = await vscode.window.showQuickPick(['toggle', 'on', 'off'], { placeHolder: 'Please select an option' });
×
44
            if (option) {
×
45
                await this.logCommandOutput(async (commandController) => commandController.fpsDisplay(option as 'toggle' | 'on' | 'off'));
×
46
            }
47
        }));
48

49
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.free', async () => {
12✔
50
            await this.logCommandOutput(async (commandController) => commandController.free());
×
51
        }));
52

53
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.genkey', async () => {
12✔
54
            await this.logCommandOutput(async (commandController) => commandController.genkey());
×
55
        }));
56

57
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.loadedTextures', async () => {
12✔
58
            await this.logCommandOutput(async (commandController) => commandController.loadedTextures());
×
59
        }));
60

61
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.logrendezvous', async () => {
12✔
62
            let option = await vscode.window.showQuickPick(['status', 'on', 'off'], { placeHolder: 'Please select an option' });
×
63
            if (option) {
×
64
                await this.logCommandOutput(async (commandController) => commandController.logrendezvous(option as 'status' | 'on' | 'off'));
×
65
            }
66
        }));
67

68
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.plugins', async () => {
12✔
69
            await this.logCommandOutput(async (commandController) => commandController.plugins());
×
70
        }));
71

72
        // TODO: press? likely needs to go in the old area.
73
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.press', async () => {
12✔
74
            let keys = (await vscode.window.showInputBox({ placeHolder: 'comma separated list of keys' })).split(',');
×
75
            if (keys.length > 1) {
×
76
                await this.logCommandOutput(async (commandController) => commandController.press(keys));
×
77
            }
78
        }));
79

80
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.r2d2bitmaps', async () => {
12✔
81
            await this.logCommandOutput(async (commandController) => commandController.r2d2Bitmaps());
×
82
        }));
83

84
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.removePlugin', async () => {
12✔
85
            let pluginId = await vscode.window.showInputBox({ placeHolder: 'plugin_id' });
×
86

87
            if (pluginId) {
×
88
                await this.logCommandOutput(async (commandController) => commandController.removePlugin(pluginId));
×
89
            }
90
        }));
91

92
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.sgnodesAll', async () => {
12✔
93
            await this.logCommandOutput(async (commandController) => commandController.sgnodes('all'));
×
94
        }));
95

96
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.sgnodesRoots', async () => {
12✔
97
            await this.logCommandOutput(async (commandController) => commandController.sgnodes('roots'));
×
98
        }));
99

100
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.sgnodesNodeId', async () => {
12✔
101
            let nodeId = await vscode.window.showInputBox({ placeHolder: 'node_id' });
×
102
            if (nodeId) {
×
103
                await this.logCommandOutput(async (commandController) => commandController.sgnodes(nodeId));
×
104
            }
105
        }));
106

107
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.sgperfStart', async () => {
12✔
108
            await this.logCommandOutput(async (commandController) => commandController.sgperf('start'));
×
109
        }));
110

111
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.sgperfStop', async () => {
12✔
112
            await this.logCommandOutput(async (commandController) => commandController.sgperf('stop'));
×
113
        }));
114

115
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.sgperfClear', async () => {
12✔
116
            await this.logCommandOutput(async (commandController) => commandController.sgperf('clear'));
×
117
        }));
118

119
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.sgperfReport', async () => {
12✔
120
            await this.logCommandOutput(async (commandController) => commandController.sgperf('report'));
×
121
        }));
122

123
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.showkey', async () => {
12✔
124
            await this.logCommandOutput(async (commandController) => commandController.showkey());
×
125
        }));
126

127
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.brightscriptWarnings', async () => {
12✔
128
            let limit = parseInt(await vscode.window.showInputBox({ placeHolder: '100', validateInput: (value: string) => {
×
129
                if (isNaN(parseInt(value))) {
×
130
                    return 'Input must be a numeric value';
×
131
                }
132
            } }));
133

134
            if (!isNaN(limit)) {
×
135
                await this.logCommandOutput((commandController) => commandController.brightscriptWarnings(limit));
×
136
            }
137
        }));
138

139
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.custom8080Command', async () => {
12✔
140
            let command = await vscode.window.showInputBox({ placeHolder: 'custom command' });
×
141
            if (command) {
×
142
                await this.logCommandOutput(async (commandController) => commandController.exec(command));
×
143
            }
144
        }));
145
    }
146

147
    private async logCommandOutput(callback: (controller: SceneGraphDebugCommandController) => Promise<SceneGraphCommandResponse>) {
148
        //active device first (LAN or Roku Cloud Emulator - the controller accepts either device
149
        //config), then the legacy host fallbacks / device picker
NEW
150
        const target = await this.deviceTargetManager.resolveActiveTargetDevice();
×
NEW
151
        if (!target) {
×
NEW
152
            return;
×
153
        }
NEW
154
        let response = await callback(new SceneGraphDebugCommandController(target.device));
×
155

156
        this.outputChannel.show();
×
157

158
        // The output channel seems to have a limit to the amount of output that can be displayed in a single log.
159
        // For this reason we split the output into groups of 20 lines and send each group. If we don't do this a lot of
160
        // the middle of the string gets cut out.
161
        let lines = (response?.error?.message ?? response.result.rawResponse).split('\n');
×
162
        let lineGroups = this.chunkArray(lines);
×
163

164
        // Log the command statement
165
        this.outputChannel.append(`>${response.command}\n`);
×
166

167
        // Log each group of 20 lines
168
        for (let lineGroup of lineGroups) {
×
169
            this.outputChannel.append(lineGroup.join('\n') + '\n');
×
170
        }
171
    }
172

173
    private chunkArray(arr: Array<any>, chunkSize = 20) {
×
174
        if (chunkSize <= 0) {
×
175
            return arr;
×
176
        }
177

178
        let chunks = [];
×
179
        for (let i = 0, len = arr.length; i < len; i += 20) {
×
180
            chunks.push(arr.slice(i, i + chunkSize));
×
181

182
        }
183

184
        return chunks;
×
185
    }
186

187
}
188

189
export const sceneGraphDebugCommands = new SceneGraphDebugCommands();
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc