我需要把我安装的所有扩展发给我的同事。我如何导出它们?
扩展管理器似乎什么也不做…它不会安装任何扩展。
我需要把我安装的所有扩展发给我的同事。我如何导出它们?
扩展管理器似乎什么也不做…它不会安装任何扩展。
当前回答
我使用下面的命令将我的扩展从Visual Studio Code复制到Visual Studio Code内部:
code --list-extensions | xargs -L 1 code-insiders --install-extension
参数- l1允许我们对由code——list-extensions生成的每个输入行执行一次命令code-insiders——install-extension。
其他回答
有一个扩展管理器扩展,这可能会有所帮助。它似乎允许安装一组在settings.json中指定的扩展。
我自己也需要这样做几次——尤其是在另一台机器上安装时。
常见问题会告诉你文件夹的位置
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
如果您打算跨团队共享工作空间扩展配置,您应该查看Visual Studio Code的推荐扩展特性。
要生成该文件,请打开命令托盘> Configure Recommended Extensions (Workspace Folder)。从那里,如果你想获得所有当前的扩展并将它们放在这里,你可以使用——list-extensions在其他答案中提到的东西,但添加一些AWK脚本,使其可粘贴到JSON数组中(你可以根据自己的需要获得更多或更少的高级功能-这只是一个快速示例):
代码——list-extensions | awk的{打印“\”“0”\“\”}”
这种方法的优点是可以将团队范围内的工作空间配置检入源代码控制。有了这个文件在项目中,当项目打开时,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 ...
自动
如果你期待一个简单的一站式工具来为你做这件事,我建议你看看设置同步扩展。
它将允许
导出您的配置和扩展 与同事和团队分享。您可以更新配置。他们的设置将自动更新。
手册
Make sure you have the most current version of Visual Studio Code. If you install via a company portal, you might not have the most current version. On machine A Unix: code --list-extensions | xargs -L 1 echo code --install-extension Windows (PowerShell, e. g. using Visual Studio Code's integrated Terminal): code --list-extensions | % { "code --install-extension $_" } Copy and paste the echo output to machine B Sample output code --install-extension Angular.ng-template code --install-extension DSKWRK.vscode-generate-getter-setter code --install-extension EditorConfig.EditorConfig code --install-extension HookyQR.beautify
请确保已安装了代码命令行。如需了解更多信息,请访问CLI。