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

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


当前回答

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

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

https://code.visualstudio.com/docs/editor/extension-gallery#_workspace-recommended-extensions

共享扩展列表的更好方法是为同事创建基于工作空间的扩展集。

在通过code——list-extensions | xargs -L 1 echo code——install-extension生成扩展列表后(在运行代码命令之前,检查您的$PATH包含Visual Studio code条目C:\Program Files\Microsoft VS code \bin\),运行extensions: Configure Recommended extensions (Workspace Folder) Visual Studio code命令(Ctrl + Shift + P)并将扩展放入生成的.vscode/extensions中。json文件:

{
    "recommendations": [
        "eg2.tslint",
        "dbaeumer.vscode-eslint",
        "msjsdiag.debugger-for-chrome"
    ]
}

有一个扩展管理器扩展,这可能会有所帮助。它似乎允许安装一组在settings.json中指定的扩展。

仅适用于Linux/Mac,以安装脚本的形式导出已安装的Visual Studio Code扩展。它是一个Z shell (Zsh)脚本,但也可以在Bash中运行。

https://gist.github.com/jvlad/6c92178bbfd1906b7d83c69780ee4630

转储扩展:

code --list-extensions > extensions.txt

使用Bash (Linux, OS X和WSL)安装扩展:

cat extensions.txt | xargs code --list-extensions {}

在Windows上使用PowerShell安装扩展:

cat extensions.txt |% { code --install-extension $_}