【问题标题】:Is there a way to enable camel humping through method names in VS Code?有没有办法通过 VS Code 中的方法名称启用骆驼驼峰?
【发布时间】:2016-11-14 16:37:54
【问题描述】:

由于this question 是针对“大”Visual Studio 和 Resharper,我也希望在 VS Code 中看到该功能。

滚动浏览 VS Code 的 shortcut list,我找不到它,但我希望它仍然存在,但称为不如 camel 直观的东西,hump 之类的。

【问题讨论】:

    标签: keyboard-shortcuts visual-studio-code camelcasing


    【解决方案1】:

    从 1.25 版开始,这些命令已内置:

    【讨论】:

    • 这很可靠,您可以在没有 alt 键的情况下将它们全部重新绑定,非常完美
    • 这应该改为接受的解决方案!谢谢。
    【解决方案2】:

    我发现这个扩展可以工作 https://marketplace.visualstudio.com/items?itemName=ow.vscode-subword-navigation

    有趣的是你需要单独配置每个组合:

    {
        "key": "alt+left",
        "command": "subwordNavigation.cursorSubwordLeft",
        "when": "editorTextFocus"
    },
    {
        "key": "alt+right",
        "command": "subwordNavigation.cursorSubwordRight",
        "when": "editorTextFocus"
    },
    {
        "key": "alt+shift+left",
        "command": "subwordNavigation.cursorSubwordLeftSelect",
        "when": "editorTextFocus"
    },
    {
        "key": "alt+shift+right",
        "command": "subwordNavigation.cursorSubwordRightSelect",
        "when": "editorTextFocus"
    },
    {
        "key": "alt+backspace",
        "command": "subwordNavigation.deleteSubwordLeft",
        "when": "editorTextFocus"
    },
    {
        "key": "alt+delete",
        "command": "subwordNavigation.deleteSubwordRight",
        "when": "editorTextFocus"
    }
    

    【讨论】:

    • 那是 Visual Studio 还是 Visual Studio Code 的?
    • 请忽略我之前的评论。当然,它适用于 VS Code。完全是我的坏事。事实上,我只是对其进行了测试,并且效果很好。谢谢,伙计!
    • 在哪里应用这些设置?由于它不是有效的json(缺少顶级属性),因此无法添加到User Settings
    • @Swaps 您需要将其应用于keybindings.json。最简单的访问方式就是在命令搜索窗口中输入shortcuts
    • 此功能现已集成到应用程序中:无需插件,请参阅:stackoverflow.com/a/51329169/3757110
    【解决方案3】:

    如果由于某些原因您的绑定没有在此处设置是获取 Cezn 快捷方式的 json。

    {
        "key": "ctrl+alt+right",
        "command": "cursorWordPartRight",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+alt+shift+right",
        "command": "cursorWordPartRightSelection",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+alt+left",
        "command": "cursorWordPartLeft",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+alt+shift+left",
        "command": "cursorWordPartLeftSelection",
        "when": "editorTextFocus"
    }
    {
        "key": "ctrl+alt+backspace",
        "command": "deleteWordPartLeft",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+alt+delete",
        "command": "deleteWordPartRight",
        "when": "editorTextFocus && !editorReadonly"
    }
    

    小心使用 ctrl+alt+delete ,因为它与另一个流行的 Windows 快捷方式冲突。

    其他有趣的绑定是:

    {
        "key": "ctrl+n",
        "command": "explorer.newFile",
        "when": "explorerViewletFocus"
    },
    {
        "key": "ctrl+shift+n",
        "command": "explorer.newFolder",
        "when": "explorerViewletFocus"
    }
    

    【讨论】:

      【解决方案4】:

      有一个扩展名:Camel Case Navigation

      【讨论】:

        猜你喜欢
        • 2010-12-09
        • 1970-01-01
        • 1970-01-01
        • 2015-07-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-09-14
        相关资源
        最近更新 更多