我需要把我安装的所有扩展发给我的同事。我如何导出它们?

扩展管理器似乎什么也不做…它不会安装任何扩展。


当前回答

文件>首选项>打开设置同步将在不同的设备上同步你的VS Code设置。

我使用的是VS Code版本1.74.0

其他回答

对于那些想知道如何将扩展从Visual Studio Code复制到Visual Studio Code内部的人,可以使用本尼的答案修改:

code --list-extensions | xargs -L 1 echo code-insiders --install-extension

我打开Visual Studio Code扩展文件夹并执行:

find * -maxdepth 2 -name "package.json" | xargs grep "name"

这将为您提供一个列表,您可以从中提取扩展名。

代码——扩展>列表 Sed -i 's/。*/\"&\",/' 列表 复制文件列表的内容并添加到文件.vscode/extensions。Json在“建议”部分。 如果扩展。Json不存在,然后用以下内容创建一个文件 { “建议”:[ //在这里添加文件列表内容 ] } 共享扩展。Json文件,并要求另一个用户添加到.vscode文件夹。Visual Studio Code将提示安装扩展。

其他答案需要发送一个文件,我认为这太繁琐了。如果您需要将所有扩展名发送到另一台计算机上安装,请使用以下方式列出您的扩展名:

code --list-extensions

你可以使用如下格式的单行命令安装多个扩展:

code --install-extension dakshmiglani.hex-to-rgba --install-extension techer.open-in-browser

一个简单的方法来格式化你的扩展列表来创建命令是做一个regex搜索和替换:

Paste your copied list into a new document and search for: (.+)(\n?) Replace with --install-extension $1 (Don't omit the space at the beginning.) Add the word code to the start of the resulting text and you'll have a very large command that you can hand off to your colleagues to run in their terminal. code --install-extension hbenl.vscode-test-explorer --install-extension maciejdems.add-to-gitignore --install-extension techer.open-in-browser --install-extension traBpUkciP.vscode-npm-scripts ...

我自己也需要这样做几次——尤其是在另一台机器上安装时。

常见问题会告诉你文件夹的位置

Visual Studio Code在扩展文件夹.vscode/extensions下查找扩展。取决于你所在的平台:

Windows %USERPROFILE%\.vscode\extensions
Mac ~/.vscode/extensions
Linux ~/.vscode/extensions

这应该会显示一个扩展列表。

我还成功地使用Visual Studio代码设置同步扩展将设置同步到GitHub要点。

在Visual Studio Code的最新版本(2016年5月)中,现在可以在命令行中列出已安装的扩展:

code --list-extensions