diff --git a/package.json b/package.json index 778372b8..5e702a8e 100644 --- a/package.json +++ b/package.json @@ -2731,6 +2731,12 @@ "description": "Clear the BrightScript extension's global state.", "category": "Brightscript" }, + { + "command": "extension.brightscript.clearActiveDevice", + "title": "Clear Active Device", + "description": "Clear the BrightScript extension's active device.", + "category": "Brightscript" + }, { "command": "extension.brightscript.toggleXML", "title": "Toggle XML/BRS", diff --git a/src/BrightScriptCommands.ts b/src/BrightScriptCommands.ts index 65a8e963..28772369 100644 --- a/src/BrightScriptCommands.ts +++ b/src/BrightScriptCommands.ts @@ -322,6 +322,23 @@ export class BrightScriptCommands { } }); + this.registerCommand('setActiveDevice', async (device: string) => { + if (!device) { + device = await this.userInputManager.promptForHost(); + } + if (!device) { + throw new Error('Tried to set active device but failed.'); + } else { + await this.context.workspaceState.update('remoteHost', device); + await vscode.window.showInformationMessage(`BrightScript Language extension active device set to: ${device}`); + } + }); + + this.registerCommand('clearActiveDevice', async () => { + await this.context.workspaceState.update('remoteHost', ''); + await vscode.window.showInformationMessage('BrightScript Language extension active device cleared'); + }); + this.registerCommand('showReleaseNotes', () => { this.whatsNewManager.showReleaseNotes(); }); diff --git a/src/viewProviders/OnlineDevicesViewProvider.ts b/src/viewProviders/OnlineDevicesViewProvider.ts index ab34d14a..9af4943a 100644 --- a/src/viewProviders/OnlineDevicesViewProvider.ts +++ b/src/viewProviders/OnlineDevicesViewProvider.ts @@ -129,6 +129,20 @@ export class OnlineDevicesViewProvider implements vscode.TreeDataProvider=11')) { // TODO: add ECP system hooks here in the future (like registry call, etc...) result.unshift(