Skip to content

Commit

Permalink
remoteControlMode type change
Browse files Browse the repository at this point in the history
  • Loading branch information
iBicha committed Sep 28, 2023
1 parent fa8c8dd commit e32e45c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/DebugConfigurationProvider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('BrightScriptConfigurationProvider', () => {
s`${folder.uri.fsPath}/out/`
);
} else {
expect(config[key], `Expected "${key}" to match the default`).to.equal(configDefaults[key]);
expect(config[key], `Expected "${key}" to match the default`).to.deep.equal(configDefaults[key]);
}
}
});
Expand Down
15 changes: 12 additions & 3 deletions src/DebugConfigurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,17 @@ 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;
config.remoteControlMode = config.remoteControlMode === true ? { activateOnSessionStart: true, deactivateOnSessionEnd: true } : config.remoteControlMode;
if (typeof config.remoteControlMode === 'boolean') {
config.remoteControlMode = {
activateOnSessionStart: config.remoteControlMode,
deactivateOnSessionEnd: config.remoteControlMode
};
} else {
config.remoteControlMode = {
activateOnSessionStart: config.remoteControlMode?.activateOnSessionStart ?? this.configDefaults.remoteControlMode.activateOnSessionStart,
deactivateOnSessionEnd: config.remoteControlMode?.deactivateOnSessionEnd ?? this.configDefaults.remoteControlMode.deactivateOnSessionEnd
};
}

if (config.request !== 'launch') {
await vscode.window.showErrorMessage(`roku-debug only supports the 'launch' request type`);
Expand Down Expand Up @@ -572,5 +581,5 @@ export interface BrightScriptLaunchConfiguration extends LaunchConfiguration {
* 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 };
remoteControlMode?: { activateOnSessionStart?: boolean; deactivateOnSessionEnd?: boolean };
}
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class Extension {
if (e.type === 'brightscript') {
this.chanperfStatusBar.hide();
const config = e.configuration as BrightScriptLaunchConfiguration;
if (config.remoteControlMode && (config.remoteControlMode === true || config.remoteControlMode?.deactivateOnSessionEnd === true)) {
if (config.remoteControlMode?.deactivateOnSessionEnd) {
void this.remoteControlManager.setRemoteControlMode(false, 'launch');
}
}
Expand Down Expand Up @@ -216,7 +216,7 @@ 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)) {
if (config.remoteControlMode?.activateOnSessionStart) {
void this.remoteControlManager.setRemoteControlMode(true, 'launch');
}
} else if (isChannelPublishedEvent(e)) {
Expand Down

0 comments on commit e32e45c

Please sign in to comment.