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

Default/Active device handling #506

Open
TwitchBronBron opened this issue Oct 11, 2023 · 0 comments
Open

Default/Active device handling #506

TwitchBronBron opened this issue Oct 11, 2023 · 0 comments

Comments

@TwitchBronBron
Copy link
Member

TwitchBronBron commented Oct 11, 2023

This writeup is a work-in-progress.

We need to overhaul the experience of interacting with devices, like which device should be used by default, how to handle active device vs default device, storing passwords, etc.

Requirements:

  • in the device view, allow users to mark a device as "default". Default means "if there is no active device, make this one the active device". This should probably be an icon on the tree view.

  • in the device view, allow users to mark a device as "active" (the device that should be currently used). This should probably be an icon on the tree view.

  • allow users to define a list of devices in their user settings, with the following info:

    "brightscript.devices": [
        {
            "name": "my-favorite-roku", //optional, but required if referencing the device from launch.json
            "default": true, //optional, should only be one device marked as default
            "host": "192.168.1.33", //optional if deviceId is defined
            "deviceId": "7J968A270659", //optional if host is defined
            "password": "aaaa" //optional
        }
    ]
  • add settings for brightscript.defaultHost and brightscript.defaultPassword that will override any missing values from above

  • when the extension first starts up, it should immediately run device-info queries for any brightscript.devices to auto-populate the devices list quickly. At the same time, device discovery can run to backfill any devices not defined in the devices list.

  • launch.json should allow loading a device by name rather than specifying a host and password:

    {
        "device": "my-favorite-roku",
        //device wins over host+password
        //"host": "192.168.1.33",
        //"password": "aaaa"
    }
  • if you have not specified host/password/device info in your launch.json, then it should try to use the default device (if defined)

  • When launching a debug session, if the user hardcoded a host (or password), but a different device is currently marked as active, then show a popup box asking them how they want to proceed. The wording could be tweaked, but here's the overview:

    We detected you're launching to 'beta' but 'alpha' is the current active device. What should we do:
    - switch my active device to 'beta' (this time only)
    - switch my active device to 'beta' (and don't ask again, do this every time automatically)
    - use current active device 'beta' (this time only)
    - use current active device 'beta' (do this every time, ignore launch.json host)

Here's how host and password resolution should work:

---
---
title: Launch Debug Session
---
flowchart TD

launchJson(["is 'host' defined in launch.json?"]) --> |yes| a(["use it"])
launchJson --> |no| getFromDebugSettings["is 'brightscript.debug.host' defined in user/workspace settings?"]
getFromDebugSettings --> |yes| b(["use it"])
getFromDebugSettings --> |no| getFromActiveDevice["is a device marked 'active'?"]
getFromActiveDevice --> |yes| c(["use it"])
getFromActiveDevice --> |no| getFromDefaultDevice["is there a device marked 'default'?"]
getFromDefaultDevice --> |yes| d(["use it"])
getFromDefaultDevice --> |no| promptUser(["Prompt user to manually enter a host"])
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant