如何通过右键单击文件夹在新的vs代码实例中打开文件夹?

Yas*_*tal 4 visual-studio-code

我在VS Code实例中打开了两个文件夹。

例如(文件夹名称):A和B

我想在VS Code的新实例中打开文件夹B,但是没有通过右键单击该文件夹打开的选项。

在此处输入图片说明

甚至Atom都可以选择在新实例中打开文件夹。

在此处输入图片说明

Dan*_*Dan 16

这个扩展允许你在新的 vscode 窗口中打开一个文件夹。
VS Code 的打开文件夹上下文菜单


小智 7

您可以通过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",
Run Code Online (Sandbox Code Playgroud)

  • 这个答案与我提出的问题无关。 (10认同)
  • 谢谢,这对我有用。我通过按“cmd+”并搜索“在新窗口中打开文件夹”找到了该选项。我将其设置为“on”,现在工作正常。 (2认同)

小智 7

创建一个注册表文件,例如 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\""
Run Code Online (Sandbox Code Playgroud)

根据您的安装目录更改 Visual Studio 代码的位置 现在只需双击 OpenOnRightClick.reg 文件,确认是否询问!全部完成 !在您右键单击时,您将有一个打开的代码选项。


Ama*_*ngh 6

让我们让它变得非常简单

  1. 在 vscode 中,转到 Files --> New Window,如下图所示。这将打开一个空白的 vscode 窗口,我们将在其中打开新项目。

在此处输入图片说明

  1. 将项目文件夹拖放到 vscode 中。如下图所示

在此处输入图片说明

就是这样。新的空白窗口打开了新项目。

下面讨论另一种方式

  1. 转到要在vscode. 在文件位置,输入 URL cmd
  2. cmd 提示符将打开文件夹 URL。
  3. 在 cmd 提示符下,键入 code .
  4. 您的文件夹将在新vscode窗口中打开。