【发布时间】:2018-07-03 10:11:19
【问题描述】:
我在 VS Code 实例中打开了两个文件夹。
例如(文件夹名):A和B
我想在 VS Code 的新实例中打开文件夹 B,但是没有选项可以通过右键单击该文件夹来打开。
甚至 Atom 也可以选择在新实例中打开文件夹。
【问题讨论】:
我在 VS Code 实例中打开了两个文件夹。
例如(文件夹名):A和B
我想在 VS Code 的新实例中打开文件夹 B,但是没有选项可以通过右键单击该文件夹来打开。
甚至 Atom 也可以选择在新实例中打开文件夹。
【问题讨论】:
此扩展允许您在新的 vscode 窗口中打开文件夹。
Open Folder Context Menus for VS Code
【讨论】:
创建一个注册表文件,例如OpenOnRightClick.reg
将这些行添加到文件中:
Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Users\\xx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Users\\xx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%1\""
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\vscode]
@="Open Folder as VS Code Project"
"Icon"="\"C:\\Users\\xx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
@="\"C:\\Users\\xx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%1\""
; This will make it appear when you right click INSIDE a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode]
@="Open Folder as VS Code Project"
"Icon"="\"C:\\Users\\xx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
@="\"C:\\Users\\xx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%V\""
根据您的安装目录更改 Visual Studio 代码的位置 现在只需双击 OpenOnRightClick.reg 文件,确认是否询问! 全部做完 !在您右键单击时,您将有一个使用代码打开的选项。
【讨论】:
您可以通过 File > New window 或 ctrl+shift+n 打开一个新窗口,然后打开那里的第二个文件夹。
或“window.openFoldersInNewWindow”设置:
// Controls if folders should open in a new window or replace the last active window.
// - default: folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu)
// - on: folders will open in a new window
// - off: folders will replace the last active window
// Note that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option).
"window.openFoldersInNewWindow": "default",
【讨论】:
cmd+, 并搜索open folders in new window 找到了该选项。我将它设置为on,现在它可以正常工作了。