如何在侧边栏浏览器中显示当前文件,焦点在Visual Studio代码中

时间:2017-12-18 16:24:48

标签: visual-studio-code

是否有快捷方式在侧边栏中显示当前文件并关注该文件(侧边栏关闭时)? workbench.files.action.showActiveFileInExplorerworkbench.files.action.focusFilesExplorer

的基本组合

就像在Resharper Shift+Alt+L中一样:https://www.jetbrains.com/help/resharper/Navigation_and_Search__Locating_a_File_in_Solution_Explorer.html

2 个答案:

答案 0 :(得分:4)

分机macros

settings.json Ctrl +

"macros": {
    "showFileAndFocus": [
        "workbench.files.action.showActiveFileInExplorer",
        "workbench.files.action.focusFilesExplorer"
    ]
}

keybindings.json

{
    "key": "shift+alt+l",
    "command": "macros.showFileAndFocus"
}

答案 1 :(得分:3)

您不需要宏,可以单独使用focusFilesExplorer快捷方式:

{
    "key": "shift+alt+l",
    "command": "workbench.files.action.focusFilesExplorer",
    "when": "editorTextFocus"
}