gpt4 book ai didi

visual-studio-code - 如何使用命令行在 VSCode 中安装多个扩展

转载 作者:行者123 更新时间:2023-12-04 11:55:41 26 4
gpt4 key购买 nike

如何使用 cli 在 VSCode 中安装多个扩展?我试过:

code --install-extension xyz.local-history jock.svg

但它只安装第一个扩展 xyz.local-history .
Installing extensions...
Installing extension 'xyz.local-history' v1.7.0...
(node:10874) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Extension 'xyz.local-history' v1.7.0 was successfully installed.

最佳答案

如果您使用 Unix/Linux 创建一个带有循环的 bash 脚本。在这种情况下,我想备份扩展列表并再次安装:
首先创建一个扩展列表:

$ code --list-extensions > extensions.txt
例如,创建一个名为 vscode-extension-install.sh 的 bash 脚本并输入以下代码:
#!/usr/bin/env bash

cat extensions.txt | while read extension || [[ -n $extension ]];
do
code --install-extension $extension --force
done
然后运行:
$ ./vscode-extension-install.sh
示例输出:
Installing extensions...
Installing extension 'visualstudioexptteam.vscodeintellicode' v1.2.6...
Extension 'visualstudioexptteam.vscodeintellicode' v1.2.6 was successfully installed.
Installing extensions...
Installing extension 'vscode-icons-team.vscode-icons' v10.0.0...
Extension 'vscode-icons-team.vscode-icons' v10.0.0 was successfully installed.
...
来自 my gists

关于visual-studio-code - 如何使用命令行在 VSCode 中安装多个扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58513266/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com