Skip to content

Commit

Permalink
Enable remote control on launch
Browse files Browse the repository at this point in the history
  • Loading branch information
iBicha committed Sep 26, 2023
1 parent bdae42c commit 4d63bf9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,11 @@
"type": "boolean",
"default": false,
"description": "Delete any currently installed dev channel before starting the debug session"
},
"enableRemoteControl": {
"type": "boolean",
"default": true,
"description": "Enable remote control mode when starting the debug session"
}
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/DebugConfigurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export class BrightScriptDebugConfigurationProvider implements DebugConfiguratio
enableDebugProtocol: false,
remotePort: 8060,
rendezvousTracking: true,
deleteDevChannelBeforeInstall: false
deleteDevChannelBeforeInstall: false,
enableRemoteControl: false
};

let config: any = vscode.workspace.getConfiguration('brightscript') || {};
Expand Down Expand Up @@ -243,6 +244,7 @@ export class BrightScriptDebugConfigurationProvider implements DebugConfiguratio
config.cwd = folderUri.fsPath;
config.rendezvousTracking = config.rendezvousTracking === false ? false : true;
config.deleteDevChannelBeforeInstall = config.deleteDevChannelBeforeInstall === true;
config.enableRemoteControl = config.enableRemoteControl === true ? true : this.configDefaults.enableRemoteControl;

if (config.request !== 'launch') {
await vscode.window.showErrorMessage(`roku-debug only supports the 'launch' request type`);
Expand Down Expand Up @@ -561,4 +563,10 @@ export interface BrightScriptLaunchConfiguration extends LaunchConfiguration {
* If injectRdbOnDeviceComponent is true and this is true the screen saver will be be disabled while the deployed application is running.
*/
disableScreenSaver?: boolean;

/**
* If true, the remote control will be enabled at the start of the debug session
* @default false
*/
enableRemoteControl?: boolean;
}
7 changes: 7 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ export class Extension {
//if this is a brightscript debug session
if (e.type === 'brightscript') {
this.chanperfStatusBar.hide();
const config = e.configuration as BrightScriptLaunchConfiguration;
if (config.enableRemoteControl) {
void this.remoteControlManager.setRemoteControlMode(false, 'launch');
}
}
});

Expand Down Expand Up @@ -212,6 +216,9 @@ export class Extension {
const config = e.body as BrightScriptLaunchConfiguration;
await docLinkProvider.setLaunchConfig(config);
logOutputManager.setLaunchConfig(config);
if (config.enableRemoteControl) {
void this.remoteControlManager.setRemoteControlMode(true, 'launch');
}
} else if (isChannelPublishedEvent(e)) {
this.webviewViewProviderManager.onChannelPublishedEvent(e);
//write debug server log statements to the DebugServer output channel
Expand Down
2 changes: 1 addition & 1 deletion src/managers/RemoteControlManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ export class RemoteControlManager {
}
}

export type RemoteControlModeInitiator = 'statusbar' | 'command';
export type RemoteControlModeInitiator = 'statusbar' | 'command' | 'launch';

0 comments on commit 4d63bf9

Please sign in to comment.