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

rokucommunity / vscode-brightscript-language / 26245946839

21 May 2026 06:41PM UTC coverage: 56.627% (+1.1%) from 55.501%
26245946839

Pull #790

github

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

2275 of 4439 branches covered (51.25%)

Branch coverage included in aggregate %.

93 of 97 new or added lines in 3 files covered. (95.88%)

458 existing lines in 6 files now uncovered.

3634 of 5996 relevant lines covered (60.61%)

40.42 hits per line

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

23.91
/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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

148
    private async logCommandOutput(callback: (controller: SceneGraphDebugCommandController) => Promise<SceneGraphCommandResponse>) {
UNCOV
149
        await this.getRemoteHost();
×
UNCOV
150
        let response = await callback(new SceneGraphDebugCommandController(this.host));
×
151

152
        this.outputChannel.show();
×
153

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

160
        // Log the command statement
161
        this.outputChannel.append(`>${response.command}\n`);
×
162

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

169
    private chunkArray(arr: Array<any>, chunkSize = 20) {
×
UNCOV
170
        if (chunkSize <= 0) {
×
UNCOV
171
            return arr;
×
172
        }
173

174
        let chunks = [];
×
UNCOV
175
        for (let i = 0, len = arr.length; i < len; i += 20) {
×
UNCOV
176
            chunks.push(arr.slice(i, i + chunkSize));
×
177

178
        }
179

UNCOV
180
        return chunks;
×
181
    }
182

183
    public async getRemoteHost() {
UNCOV
184
        this.host = await this.context.workspaceState.get('remoteHost');
×
UNCOV
185
        if (!this.host) {
×
UNCOV
186
            let config = util.getConfiguration('brightscript.remoteControl');
×
187
            this.host = config.get('host');
×
188
            if (this.host === '${promptForHost}') {
×
189
                this.host = await vscode.window.showInputBox({
×
190
                    placeHolder: 'The IP address of your Roku device',
191
                    value: ''
192
                });
193
            }
194
        }
UNCOV
195
        if (!this.host) {
×
196
            throw new Error('Can\'t send command: host is required.');
×
197
        } else {
UNCOV
198
            await this.context.workspaceState.update('remoteHost', this.host);
×
199
        }
200
    }
201

202
}
203

204
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