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

Mimic VS Code Experimental devices #11323

Merged
merged 3 commits into from
Jun 24, 2022

Conversation

thegecko
Copy link
Member

What it does

VS Code has just added experimental support for requesting access to WebUSB, WebSerial and WebHID devices as outlined in microsoft/vscode#116761

The implementation is here and exposed as commands here.

This PR reflects these additions by exposing the same functionality in Theia via the commands:

  • workbench.experimental.requestUsbDevice
  • workbench.experimental.requestSerialPort
  • workbench.experimental.requestHidDevice

These are added so that extensions utilising the experimental commands will work in Theia and VS Code alike.
I haven't seen experimental commands exposed in Theia anywhere else, so keen to understand if this is OK.

How to test

Execute the commands to request access to a device.

Review checklist

Reminder for reviewers

Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't seen experimental commands exposed in Theia anywhere else, so keen to understand if this is OK.

Usually we lag far enough behind that the question of keeping up with experimental API rarely arises :-). In general I don't see any problem with it, but we'll have to watch for changes on the VSCode side to make sure that we adjust if they decide to change names before they finalize the API.

Regarding the code, one question I have is whether we should expose the interfaces somewhere (similar to the separate file in VSCode) in case we want to use them somewhere.

Signed-off-by: robmor01 <[email protected]>
@thegecko
Copy link
Member Author

we'll have to watch for changes on the VSCode side to make sure that we adjust if they decide to change names before they finalize the API.

Don't worry, I'll be watching these like a hawk!

one question I have is whether we should expose the interfaces somewhere (similar to the separate file in VSCode) in case we want to use them somewhere.

I've updated the PR to expose these interfaces, but I'd probably recommend anyone using this functionality uses the "official" types (e.g. @types/w3c-web-usb).

Users would also need to explicitly cast the return value of any executed command to the correct type due to the nature of how commands are executed.

Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me and corresponds to the same commands in VSCode.

@thegecko thegecko merged commit 9a0ae2e into eclipse-theia:master Jun 24, 2022
@thegecko thegecko deleted the experimental-vscode-devices branch June 24, 2022 14:58
@vince-fugnitto vince-fugnitto added the vscode issues related to VSCode compatibility label Jun 30, 2022
@vince-fugnitto vince-fugnitto added this to the 1.27.0 milestone Jun 30, 2022
federicobozzini pushed a commit to ARMmbed/theia that referenced this pull request Aug 24, 2022
* Add experimental device access from VS Code

Signed-off-by: thegecko <[email protected]>

* Expose interfaces

Signed-off-by: robmor01 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants