continue
continue copied to clipboard
Fix: getPlatform to return "unknown" when environment isWeb
Description
When running VS Code web users will see wrong shortcuts if the remote system is a Linux box while the user is using a Mac.
See example: The hint on the right is showing CTRL while the text box on the left is showing the CMD key.
When running VS Code remotely it's not possible to determine users platform and node.os.platform should not be trusted.
The change explicitly marks platform as unknown if vscode.env.uiKind === Web. This is relevant in remote workspaces such as Coder/Github codespaces/Project IDX etc.
If the platform is unknown show both CMD and CTRL keys.
VS Code extension API does not provide a way to identify the actual users platform.
- See https://github.com/microsoft/vscode/issues/106525 (the api is not provided)
- And https://github.com/microsoft/vscode/issues/10471 (getContext API which would solve this has not been implemented)
I appreciate this solution is not-ideal. Not sure what the proper solution the code probably needs to leverage the when api.
Checklist
- [x] The relevant docs, if any, have been updated or created
- [x] The relevant tests, if any, have been updated or created
Screenshots
Hint SVG formatting is still sane after the changes
^ Platform detected as unknown
^ Platform detected as linux
Testing instructions
Install continue extension inside github codespaces you will always see linux based shortcuts even when running on a Mac.
Deploy Preview for continuedev canceled.
| Name | Link |
|---|---|
| Latest commit | 78a102246f799ce8ecfad113e0e0ea9e63097181 |
| Latest deploy log | https://app.netlify.com/sites/continuedev/deploys/67a325815391b30008ac9801 |
After the merge
@RomneyDa let me know if you prefer something other than Ctrl/⌘
@etherandrius we should be able to request the platform from the webview, which knows the correct one. Can we do this and then remove the "+" sign?
@sestinj sure thing.
Could you point me to how the webview could send this kind of information to the node process? If you could link me the types used to communicate between the two that should be enough
@sestinj Thinking about this a bit more sending this information might not be possible? The webView is not loaded until users open the chat interface. Meaning we have to handle the edge case of users never opening the webView.
Please correct me if I have the wrong understanding.
@sestinj @RomneyDa friendly bump
✨ No issues found! Your code is sparkling clean! ✨
Closing because stale, @etherandrius if you make updates would like to merge, also making note to look into reimplementing