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

Can't change remoteHost once set #588

Open
spoyser opened this issue Sep 19, 2024 · 21 comments
Open

Can't change remoteHost once set #588

spoyser opened this issue Sep 19, 2024 · 21 comments

Comments

@spoyser
Copy link
Contributor

spoyser commented Sep 19, 2024

It would seem that once the IP of the Roku device to which you want to send remote keypresses to is set, it is then impossible to update it.
This is due to the value being stored as a memento (remoteHost) in the workspace database (stored in state.vscdb), and once set the function
getRemoteHost will always use that value regardless of the settings parameter (e.g. "brightscript.remoteControl.host":"11.23.56.90")

Using SQLite browser it is possible to update the value, and this new value is then used by the extension.

e.g.
{"rokuAutomationAutorunOnDeploy":true,"rokuAutomationConfigs":"{\"configs\":[{\"name\":\"DEFAULT\",\"s0teps\":[]}]}","remoteHost":"11.23.56.90","rokuAppOverlays":[]}

Perhaps a solution would be to always use the value from the VSCode settings, and if the value is ${promptForHost} show the input and then overwrite the setting with whatever the user entered?

@TwitchBronBron
Copy link
Member

We definitely need some improvements in this area. Our ultimate goal is to implement a proper "Default/Active Device" feature (outlined in #506).

But to your specific point right now, I believe that value will change if you sideload to a different device. If I remember correctly, it will always overwrite the value with whatever device was most recently sideloaded to.

@spoyser
Copy link
Contributor Author

spoyser commented Sep 20, 2024

That feature sounds great.

In my use case I'm not sideloading so the value is never overwritten, but I see your point :)

@TwitchBronBron
Copy link
Member

Until we get the time to properly implement #506, would you be interested in submitting a PR that adds a menu option to the device list that would switch that internal value. Something like this, with maybe a title like "Set as active device":

image

I think you'd need to add a new entry in that devices list here:


And then add the command in https://github.com/rokucommunity/vscode-brightscript-language/blob/master/src/BrightScriptCommands.ts that would set the value like we do here

@spoyser
Copy link
Contributor Author

spoyser commented Sep 22, 2024

I'll take a look and see what I can do.

@spoyser
Copy link
Contributor Author

spoyser commented Sep 22, 2024

Trying to setup a build environment using

mkdir RokuCommunity && cd RokuCommunity && git clone https://github.com/rokucommunity/vscode-brightscript-language && cd vscode-brightscript-language && npm run install-local

And getting a 404 :(

npm error code E404
npm error 404 Not Found - GET https://artifactory.tools.roku.com/artifactory/api/npm/roku/roku-test-automation/-/roku-test-automation-2.0.10.tgz
npm error 404
npm error 404  'roku-test-automation@https://artifactory.tools.roku.com/artifactory/api/npm/roku/roku-test-automation/-/roku-test-automation-2.0.10.tgz' is not in this registry.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.

Right, I followed the manual approach and got everything installed (as a FYI there is a type in the manual instructions, "roku-deploy": "file:../roku-debug", should obviously be "roku-deploy": "file:../roku-deploy",)

I've updated code, build seems to complete successfully, but then what, I was kind of expecting a .vsix file to be created.

@TwitchBronBron
Copy link
Member

Next:

  • open the vscode-brightscript-language folder in vscode
  • in the debug panel, choose the "Extension" debug configuration from the drop-down
  • press F5 to start debugging
  • vscode will open a NEW vscode window with the [extension host] name in the title. This vscode window has a live version of the current local complied copy of the vscode extension.

@spoyser
Copy link
Contributor Author

spoyser commented Sep 22, 2024

Okay, getting further :)

In the second VSCode running the BRS extension is showing but after a while it gives the following error:
Activating extension 'RokuCommunity.brightscript' failed: vscode.workspace.workspaceFolders is not iterable.

Any ideas?

@TwitchBronBron
Copy link
Member

Does it give you a stack trace? You can find that in the debug panel of the non [extension host] window. Does it happen with the code directly from master or was this an issue introduced by your new code?

@spoyser
Copy link
Contributor Author

spoyser commented Sep 22, 2024

I thought much the same so I did revert the code, but behaves the same

Debug Console

vscode-custom-css is active!
Application directory c:\Users\spoyser\AppData\Local\Programs\Microsoft VS Code\resources\app\out
Main HTML file c:\Users\spoyser\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\code\electron-sandbox\workbench\workbench.html
Git installation not found.

Call Stack
image

@TwitchBronBron
Copy link
Member

I'm not really sure what's going on then. Let's try starting over. The install-local command is a bit overkill for this specific task because you don't need to work on any of the other projects (roku-deploy, roku-debug, etc) since this feature is exclusively located in vscode-brightscript-language. So, let's try this:

  • git clone https://github.com/rokucommunity/vscode-brightscript-language
  • cd vscode-brightscript-language
  • npm install

Then open the folder with vscode, and in the menu at the top click "Run" -> "Start Debugging" start debugging. It'll run a few build tasks automatically, then it will launch the [Extension Host].

@spoyser
Copy link
Contributor Author

spoyser commented Sep 22, 2024

Behaved exactly the same.

Thought maybe it was a windows thing so tried again in Linux and got this error again when I tried the npm install

npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE   package: '[email protected]',
npm warn EBADENGINE   required: { vscode: '^1.57.0', node: '^12.12.0' },
npm warn EBADENGINE   current: { node: 'v20.17.0', npm: '10.8.2' }
npm warn EBADENGINE }
npm warn deprecated @types/[email protected]: This is a stub types definition for chalk (https://github.com/chalk/chalk). chalk provides its own type definitions, so you don't need @types/chalk installed!
npm warn deprecated [email protected]: this library is no longer supported
npm warn deprecated [email protected]: This package has been renamed to @vscode/debugprotocol, please update to the new name
npm warn deprecated [email protected]: Please upgrade to 2.3.7 which fixes GHSA-4q6p-r6v2-jvc5
npm warn deprecated [email protected]: This package has been renamed to @vscode/debugadapter, please update to the new name
npm warn deprecated [email protected]: 16.1.1
npm error code E404
npm error 404 Not Found - GET https://artifactory.tools.roku.com/artifactory/api/npm/roku/roku-test-automation/-/roku-test-automation-2.0.10.tgz
npm error 404
npm error 404  'roku-test-automation@https://artifactory.tools.roku.com/artifactory/api/npm/roku/roku-test-automation/-/roku-test-automation-2.0.10.tgz' is not in this registry.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
npm error A complete log of this run can be found in: /home/spoyser/.npm/_logs/2024-09-22T13_04_13_288Z-debug-0.log

@spoyser
Copy link
Contributor Author

spoyser commented Sep 22, 2024

Not sure if this is relevant?
image

@TwitchBronBron
Copy link
Member

@triwav this looks like it might be an issue with rta. Any thoughts on why it's failing to install?

@TwitchBronBron
Copy link
Member

@spoyser it appears that you're using artifactory as some type of middleware package management suite. Can you check with that team to see if they're blocking packages with the word "roku" in it somewhere? Or can you try bypassing using artifactory instead to see if it will work with that removed from the equation?

npm error 404 'roku-test-automation@https://artifactory.tools.roku.com/artifactory/api/npm/roku/roku-test-automation/-/roku-test-automation-2.0.10.tgz' is not in this registry

@spoyser
Copy link
Contributor Author

spoyser commented Sep 23, 2024

Ah yes I see that, although that is only on the Linux environment.

Still doesn't explain the issue I'm seeing on Windows (I assume it should work on Windows?):
Activating extension 'RokuCommunity.brightscript' failed: vscode.workspace.workspaceFolders is not iterable.

@TwitchBronBron
Copy link
Member

TwitchBronBron commented Sep 23, 2024

Hmm, I'm not sure why it would be failing with that message. I work on this project almost exclusively on windows and haven't seen this issue before. Would you be open to chatting more about this on our RokuCommunity slack? (I'm @Bronley Plumb )

image

I'd love to help you get this issue unblocked,

@TwitchBronBron
Copy link
Member

Hey @spoyser I think I found the issue and resolved it. I have no idea why this issue was happening only sometimes, but it started happening randomly to me today so I was able to fix it and then ensure it was resolved.

Can you pull latest from the repo and try again? Also, thank you so much for your patience.

@spoyser
Copy link
Contributor Author

spoyser commented Sep 27, 2024

@TwitchBronBron
That's great news, I'll give it a whirl and let you know how I get on (I was gonna contact you via Slack but been snowed under for that last week)

@spoyser
Copy link
Contributor Author

spoyser commented Sep 29, 2024

All done, I added a clear active device for a particular use case of mine too.

@spoyser
Copy link
Contributor Author

spoyser commented Sep 29, 2024

I’ve been thinking about this a bit more and IMO the remoteHost setting in the settings file should be removed.

There is no benefit to setting it except for the very first use, where it would save you have to enter it in the input box. But once the value is in the VSCode database this setting has zero effect and in fact is just confusing because it has no effect.

I think it should be removed and the code always prompt for the value if it is currently not set in the database, this works well in conjunction with the clearActiveHost command I added (which can easily be bound to a key-press).

In which case maybe active host should be renamed to remote host.

Let me know what you think.

@TwitchBronBron
Copy link
Member

I think it should be removed and the code always prompt for the value if it is currently not set in the database

I mostly agree with you. However, I'm hesitant to remove it, just for legacy purposes at the moment. I think once we get into actually implementing #506 , we can eliminate the setting then.

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

2 participants