Android 上 Chrome 网络浏览器中的 VSCode:如何使 {[]} 工作?

问题描述 投票:0回答:2

我正在 RPi 4B/8GB 上部署 VSCode 服务器,以便在浏览器中从 Android 平板电脑访问 VSCode,而无需安装任何 termux。就我而言,termux 上的 VScode 不是一个选项,因为我正在开发需要额外系统权限的系统附近容器工作负载。

  • VSCode 服务器是:coder/code-server.
  • 平板电脑是带有三星键盘盖的三星 Tab S7+。
  • 最新的 Chrome 应用程序版本。
  • 平板电脑使用终端通过 SSH 隧道将端口转发到 VSCode 服务器的端口。
  • 我使用的是标准的 104 键键盘布局;我已经放弃了布局并将其保存为
    .local/share/code-server/User/keyboardLayout.json

不幸的是,这不适用于与 AltGr 相关的键。启用开发人员键绑定(原文如此!)输出后,我可以在按 AltGr+8 时捕获此输出,这应该对应于

[
:

这表明 Chromium 实际上发送了

[
键,但是使用了
AltRight
而不是
AltGr
。 (在旁注中,Android 上的 Firefox 实际上发送 AltGr,但有其他怪癖使它完全不适合浏览器中的 VSCode。)

不幸的是,我找不到任何关于布局 JSON 模式如何工作以及如何解决甚至没有发送 AltGr 的情况的 VSCode 或 Electron 文档。

我怎样才能解决这个问题并使键盘布局正常工作?最好,任何修复不仅应该在文本编辑器中工作,而且还应该在终端中工作。

android google-chrome visual-studio-code keyboard-events keyboard-layout
2个回答
1
投票

我在使用 Gitpod 的 VSCode 中使用带有物理键盘的 Android 平板电脑遇到了类似的问题,我的问题与使用 AltGr 时 VSCode 执行 Alt 的键绑定命令有关。我的解决方案是删除所有冲突的 Alt + 命令绑定。这是我用于重置数字键的 keybindings.json。

[
    {
        "key": "alt+1",
        "command": "-workbench.action.openEditorAtIndex1"
    },
    {
        "key": "alt+2",
        "command": "-workbench.action.openEditorAtIndex2"
    },
    {
        "key": "alt+3",
        "command": "-workbench.action.openEditorAtIndex3"
    },
    {
        "key": "alt+4",
        "command": "-workbench.action.openEditorAtIndex4"
    },
    {
        "key": "alt+5",
        "command": "-workbench.action.openEditorAtIndex5"
    },
    {
        "key": "alt+6",
        "command": "-workbench.action.openEditorAtIndex6"
    },
    {
        "key": "alt+7",
        "command": "-workbench.action.openEditorAtIndex7"
    },
    {
        "key": "alt+8",
        "command": "-workbench.action.openEditorAtIndex8"
    },
    {
        "key": "alt+9",
        "command": "-workbench.action.openEditorAtIndex9"
    },
    {
        "key": "alt+0",
        "command": "-workbench.action.lastEditorInGroup"
    }
]

0
投票

就我而言,

Shift+AltRight
会提供
AltGr
功能。我在 Android 平板电脑上的 Chrome 上使用 VSCode for Web 进行编码。在物理键盘上,键帽实际上是 Alt Gr.

© www.soinside.com 2019 - 2024. All rights reserved.