Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable remote control on launch #503

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,28 @@
"type": "boolean",
"default": false,
"description": "Delete any currently installed dev channel before starting the debug session"
},
"remoteControlMode": {
"oneOf": [
{
"type": "object",
"description": "Options for activating and deactivating remote control mode",
"properties": {
"activateOnSessionStart": {
"type": "boolean",
"description": "Activate remote control mode on debug session start"
},
"deactivateOnSessionEnd": {
"type": "boolean",
"description": "Deactivate remote control mode on session end"
}
}
},
{
"type": "boolean",
"description": "Activate on session start, deactivate on session end."
}
]
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/DebugConfigurationProvider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,19 @@ describe('BrightScriptConfigurationProvider', () => {
expect(config.packagePort).to.equal(1234);
expect(config.remotePort).to.equal(5678);
});

[
{ input: true, expected: { activateOnSessionStart: true, deactivateOnSessionEnd: true } },
{ input: false, expected: { activateOnSessionStart: false, deactivateOnSessionEnd: false } },
{ input: undefined, expected: { activateOnSessionStart: false, deactivateOnSessionEnd: false } }
].forEach(({ input, expected }) => {
it('allows using a bool value for remoteConfigMode', async () => {
let config = await configProvider.resolveDebugConfiguration(folder, <any>{
remoteControlMode: input
});
expect(config.remoteControlMode).to.deep.equal(expected);
});
});
});

describe('processLogfilePath', () => {
Expand Down
14 changes: 13 additions & 1 deletion src/DebugConfigurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ export class BrightScriptDebugConfigurationProvider implements DebugConfiguratio
enableDebugProtocol: false,
remotePort: 8060,
rendezvousTracking: true,
deleteDevChannelBeforeInstall: false
deleteDevChannelBeforeInstall: false,
remoteControlMode: {
activateOnSessionStart: false,
deactivateOnSessionEnd: false
}
};

let config: any = vscode.workspace.getConfiguration('brightscript') || {};
Expand Down Expand Up @@ -243,6 +247,8 @@ export class BrightScriptDebugConfigurationProvider implements DebugConfiguratio
config.cwd = folderUri.fsPath;
config.rendezvousTracking = config.rendezvousTracking === false ? false : true;
config.deleteDevChannelBeforeInstall = config.deleteDevChannelBeforeInstall === true;
config.remoteControlMode = config.remoteControlMode ? config.remoteControlMode : this.configDefaults.remoteControlMode;
iBicha marked this conversation as resolved.
Show resolved Hide resolved
config.remoteControlMode = config.remoteControlMode === true ? { activateOnSessionStart: true, deactivateOnSessionEnd: true } : config.remoteControlMode;

if (config.request !== 'launch') {
await vscode.window.showErrorMessage(`roku-debug only supports the 'launch' request type`);
Expand Down Expand Up @@ -561,4 +567,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, and disabled at the end of the debug session.
* @default false
*/
remoteControlMode?: boolean | { activateOnSessionStart?: boolean; deactivateOnSessionEnd?: boolean };
iBicha marked this conversation as resolved.
Show resolved Hide resolved
}
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.remoteControlMode && (config.remoteControlMode === true || config.remoteControlMode?.deactivateOnSessionEnd === true)) {
iBicha marked this conversation as resolved.
Show resolved Hide resolved
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.remoteControlMode && (config.remoteControlMode === true || config.remoteControlMode?.activateOnSessionStart === true)) {
iBicha marked this conversation as resolved.
Show resolved Hide resolved
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';