Android 上 Chrome 网络浏览器中的 VSCode:如何使 {[]} 工作?
我在 RPi 4B/8GB 上部署 VSCode 服务器,以便在浏览器中从 Android 平板电脑访问 VSCode,无需安装任何 termux。就我而言,termux 上的 VScode 不是一个选择,因为我正在开发需要额外系统权限的系统附近容器工作负载。
- VSCode 服务器是:coder/code-server。
- 平板电脑是带有三星键盘盖的三星 Tab S7+。
- 最新的 Chrome 应用版本。
- 平板电脑使用 terminus 通过 SSH 隧道运行到 VSCode 服务器端口的端口转发。
- 我使用标准的 104 键键盘布局;我已转储布局并将其保存为
.local/share/code-server/User/keyboardLayout.json
不幸的是,这对于与 AltGr 相关的键不起作用。启用开发人员键绑定(原文如此!)输出后,我能够在按 AltGr+8 时捕获此输出,它应对应于 [
:
这表明 Chromium实际上发送[
键,但使用 AltRight
而不是 AltGr
。 (顺便说一句,Android 上的 Firefox 实际上会发送 AltGr,但有其他怪癖,使其完全不适合浏览器中的 VSCode。)
不幸的是,我找不到任何有关布局 JSON 模式如何工作以及如何使用 VSCode 或 Electron 的文档。修复甚至不发送 AltGr 的情况。
我该如何解决这个问题并制作正常工作的键盘布局?最好,任何修复不仅应该在文本编辑器中起作用,而且还应该在终端中起作用。
I'm deploying a VSCode server on an RPi 4B/8GB in order to access VSCode from an Android tablet in the browser, without any termux installation. VScode on termux is not an option in my case as I'm developing system-near container workloads that require additional system privileges.
- VSCode server is: coder/code-server.
- tablet is a Samsung Tab S7+ with Samsung's keyboard cover.
- recent Chrome app version.
- tablet runs port forwarding to the VSCode server's port via an SSH tunnel, using terminus.
- I'm using a standard 104 keys de keyboard layout; I've dumped the layout and saved it as
.local/share/code-server/User/keyboardLayout.json
Unfortunately, this doesn't work with respect to AltGr-related keys. After enabling the developer key binding (sic!) output, I was able to catch this output when pressing AltGr+8, which should correspond to [
:
This reveals that Chromium actually sends the [
key, but with AltRight
instead of AltGr
. (On a sidenote, Firefox on Android actually sends AltGr, but has other quirks that make it totally unsuitable for VSCode in a browser.)
Unfortunately, I couldn't find any VSCode or Electron documentation on how the layout JSON schema works and how to fix such a situation where AltGr isn't even sent.
How can I fix this and make a properly working keyboard layout? Preferably, any fix should not only work in the text editors, but also the terminals.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在使用 Gitpod 的 VSCode 中使用带有物理键盘的 Android 平板电脑时遇到了类似的问题,我的问题与使用 AltGr 时 VSCode 执行 Alt 的键绑定命令有关。我的解决方案是删除所有冲突的 Alt + 命令绑定。这是我的 keybindings.json 用于重置数字键。
I had a similar issue with an Android tablet with physical keyboard in VSCode using Gitpod, my problem was related to VSCode executing keybinding commands for Alt when AltGr was used. Solution for me was to remove all the colliding Alt + command bindings. This is my keybindings.json for reseting numerical keys.
就我而言,
Shift+AltRight
将提供AltGr
功能。我正在 Android 平板电脑上的 Chrome 上使用 VSCode for Web 进行编码。在物理键盘上,键帽实际上显示为Alt Gr。In my case,
Shift+AltRight
would giveAltGr
functionality. I am coding with VSCode for Web on Chrome on an Android tablet. On the physical keyboard, the keycap actually reads Alt Gr.