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.