今天微软发布了Visual Studio Code文件/文件夹编辑器。

第一个限制是它似乎是一个单实例应用程序。

是否有一种方法可以获得多个实例,或者让它同时打开多个文件夹?


当前回答

同一项目的多个实例

解决方案

你不能打开同一个文件夹的多个实例,但我发现的一个变通办法是打开不同的文件夹。

lib
-components
-models
-helpers
tests

所以,在这里,我可以在不同的窗口中打开组件、模型和测试,然后我可以在我的三个显示器上查看它们。

这听起来有点简单,但这对我帮助很大。

其他回答

在Linux上,你可以使用——user-data-dir参数来运行它 我使用的是VSCodium版本,因此它有一个不同的名称,但它也应该适用于标准版本

我从~/复制了配置。在VSCodium2文件夹下 现在可以运行第二个codium实例:

——user-data-dir ~/.config/VSCodium2

我还创建了一个新的.desktop文件:/usr/share/applications/VSCodium2.desktop 在那里,我必须改变Name和Exec属性来启动VSCodium2

有了这些设置,我可以用我的启动器运行多个实例

除了.desktop文件和位置之外,所有这些都应该适用于Windows和Mac

Ctrl+ Shift + N将打开一个新窗口,而Ctrl+K则释放键,按O将在一个新窗口中打开当前选项卡。然后,您可以使用菜单文件→打开文件夹,在每个窗口中有两个不同文件夹的Visual Studio Code实例。

Mac⌘+ Shift + N和⌘+ K。

有用的快捷键列表可以在这里找到。

同一项目的多个实例

解决方案

你不能打开同一个文件夹的多个实例,但我发现的一个变通办法是打开不同的文件夹。

lib
-components
-models
-helpers
tests

所以,在这里,我可以在不同的窗口中打开组件、模型和测试,然后我可以在我的三个显示器上查看它们。

这听起来有点简单,但这对我帮助很大。

我喜欢从运行提示符/对话框打开Visual Studio Code,用一个甜美而简单的cmd /c代码-n。由于运行对话框还维护每个用户的命令历史记录,因此非常方便。一键走

如果你使用VS Code用于多种目的(c#, Python,数据库客户端等),用不同的颜色和主题在任务栏中分离每个实例是很有用的。

要做到这一点,你可以结合使用这些技巧:

For having separated icons in taskbar follow these steps (taken from https://www.reddit.com/r/vscode/comments/fkplzc/how_do_i_prevent_vscode_portable_copies_from/fkulriu?utm_source=share&utm_medium=web2x&context=3): Download portable version from https://code.visualstudio.com/docs/editor/portable (go to download page link and get proper '.zip' file), extract it somewhere and create a folder named 'data' in it (beside code.exe) to enable portable mode. Open directory {vscode_installation_dir}/resources/app Edit the file product.json with a text editor (VS Code/Notepad.exe/Notepad++ or whatever) Locate the key win32AppUserModelId Change its value to what you want it to be, and save the file: Now, if you run the executable, this modified copy of VS Code should remain separate from other VS Codes in the Windows Taskbar. For changing the VS Code theme color itself use Peacock (https://marketplace.visualstudio.com/items?itemName=johnpapa.vscode-peacock) For changing taskbar icon you can use https://github.com/electron/rcedit (sample use: https://www.reddit.com/r/vscode/comments/fkplzc/how_do_i_prevent_vscode_portable_copies_from/fky786v?utm_source=share&utm_medium=web2x&context=3) By pining the icons to the taskbar you can use shortcut of (Win key + Numbers) to easily open and switch between them.

最终结果: