有没有办法在VS Code中通过方法名称启用驼峰驼峰?

时间:2016-11-14 16:37:54

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

由于this question适用于“大型”Visual Studio和Resharper,我希望在VS Code中看到该功能。

滚动查看shortcut list的VS代码,我找不到它,但我希望它仍然存在,但是调用的东西不如驼峰驼峰< / em>或类似的。

3 个答案:

答案 0 :(得分:12)

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

enter image description here

答案 1 :(得分:3)

我发现此扩展程序可以使用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"
}

答案 2 :(得分:0)

如果由于某些原因未在此处设置绑定,则为获取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 +删除其中一个,因为它与另一个流行的Windows快捷方式冲突。

其他有趣的绑定是:

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