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

rokucommunity / vscode-brightscript-language / 26291440536

22 May 2026 01:44PM UTC coverage: 56.216% (+0.7%) from 55.501%
26291440536

Pull #790

github

web-flow
Merge ebe29a4a4 into b9f6aae1a
Pull Request #790: Add filter dropdown to the Devices view

2267 of 4453 branches covered (50.91%)

Branch coverage included in aggregate %.

118 of 185 new or added lines in 7 files covered. (63.78%)

3 existing lines in 1 file now uncovered.

3648 of 6069 relevant lines covered (60.11%)

40.42 hits per line

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

24.11
/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 { util } from './util';
1✔
5
import type { UserInputManager } from './managers/UserInputManager';
6

7
export class SceneGraphDebugCommands {
1✔
8
    private outputChannel: vscode.OutputChannel;
9
    private context: vscode.ExtensionContext;
10
    private userInputManager: UserInputManager;
11
    private host: string;
12

13
    public registerCommands(context: vscode.ExtensionContext, outputChannel: vscode.OutputChannel, userInputManager: UserInputManager) {
14
        this.context = context;
12✔
15
        this.outputChannel = outputChannel;
12✔
16
        this.userInputManager = userInputManager;
12✔
17
        let subscriptions = context.subscriptions;
12✔
18

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

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

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

31
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.chanperf', async () => {
12✔
32
            await this.logCommandOutput(async (commandController) => commandController.chanperf());
×
33
        }));
34

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

42
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.clearLaunchCaches', async () => {
12✔
43
            await this.logCommandOutput(async (commandController) => commandController.clearLaunchCaches());
×
44
        }));
45

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

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

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

61
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.loadedTextures', async () => {
12✔
62
            await this.logCommandOutput(async (commandController) => commandController.loadedTextures());
×
63
        }));
64

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

72
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.plugins', async () => {
12✔
73
            await this.logCommandOutput(async (commandController) => commandController.plugins());
×
74
        }));
75

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

84
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.r2d2bitmaps', async () => {
12✔
85
            await this.logCommandOutput(async (commandController) => commandController.r2d2Bitmaps());
×
86
        }));
87

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

91
            if (pluginId) {
×
92
                await this.logCommandOutput(async (commandController) => commandController.removePlugin(pluginId));
×
93
            }
94
        }));
95

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

100
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.sgnodesRoots', async () => {
12✔
101
            await this.logCommandOutput(async (commandController) => commandController.sgnodes('roots'));
×
102
        }));
103

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

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

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

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

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

127
        subscriptions.push(vscode.commands.registerCommand('extension.brightscript.showkey', async () => {
12✔
128
            await this.logCommandOutput(async (commandController) => commandController.showkey());
×
129
        }));
130

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

138
            if (!isNaN(limit)) {
×
139
                await this.logCommandOutput((commandController) => commandController.brightscriptWarnings(limit));
×
140
            }
141
        }));
142

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

151
    private async logCommandOutput(callback: (controller: SceneGraphDebugCommandController) => Promise<SceneGraphCommandResponse>) {
152
        await this.getRemoteHost();
×
153
        let response = await callback(new SceneGraphDebugCommandController(this.host));
×
154

155
        this.outputChannel.show();
×
156

157
        // The output channel seems to have a limit to the amount of output that can be displayed in a single log.
158
        // 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
159
        // the middle of the string gets cut out.
160
        let lines = (response?.error?.message ?? response.result.rawResponse).split('\n');
×
161
        let lineGroups = this.chunkArray(lines);
×
162

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

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

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

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

181
        }
182

183
        return chunks;
×
184
    }
185

186
    public async getRemoteHost() {
187
        this.host = await this.context.workspaceState.get('remoteHost');
×
188
        if (!this.host) {
×
189
            let config = util.getConfiguration('brightscript.remoteControl');
×
190
            this.host = config.get('host');
×
191
            // eslint-disable-next-line no-template-curly-in-string
NEW
192
            if (!this.host || this.host === '${promptForHost}') {
×
NEW
193
                this.host = await this.userInputManager.promptForHost();
×
194
            }
195
        }
196
        if (!this.host) {
×
197
            throw new Error('Can\'t send command: host is required.');
×
198
        } else {
199
            await this.context.workspaceState.update('remoteHost', this.host);
×
200
        }
201
    }
202

203
}
204

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

© 2026 Coveralls, Inc