Last active 1 month ago

vscode 开发必选扩展

jetsung revised this gist 5 months ago. Go to revision

1 file changed, 7 insertions

python.txt(file created)

@@ -0,0 +1,7 @@
1 + ms-python.isort
2 + ms-python.autopep8
3 + ms-python.python
4 + ms-python.vscode
5 + pylancems-python.vscode-python-envs
6 + ms-python.debugpy
7 + charliermarsh.ruff

jetsung revised this gist 5 months ago. Go to revision

1 file changed, 1 insertion, 1 deletion

install

@@ -1,7 +1,7 @@
1 1 #!/usr/bin/env bash
2 2
3 3 BASE_URL="https://gist.asfd.cn/jetsung/vscode/raw/HEAD/"
4 - LIST_FILE="install.txt" # 默认列表文件
4 + LIST_FILE="index.txt" # 默认列表文件
5 5 IDE_CMD="code" # 默认 VSCode
6 6 FORCE=false
7 7 EXTRA=""

jetsung revised this gist 5 months ago. Go to revision

2 files changed, 71 insertions, 3 deletions

README.md

@@ -5,11 +5,11 @@
5 5 |:---|:---|:---|:---|
6 6 | [**Even Better TOML**][6] | `tamasfe.even-better-toml` | - | 功能齐全的 TOML 支持 |
7 7 | [**Choose a License**][7] | `ultram4rine.vscode-choosealicense` | - | 为你的项目选择一个许可证 |
8 - | [**gitignore**][8] | `codezombiech.gitignore` | `codezombiech.gitignore` | - | 从 https://github.com/github/gitignore 仓库拉取 .gitignore 模板。支持.gitignore 文件的语言。 |
8 + | [**gitignore**][8] | `codezombiech.gitignore` | - | 从 https://github.com/github/gitignore 仓库拉取 .gitignore 模板。支持.gitignore 文件的语言。 |
9 9
10 10 [6]:https://github.com/tamasfe/taplo
11 11 [7]:https://github.com/ultram4rine/vscode-choosealicense
12 12 [8]:https://github.com/CodeZombieCH/vscode-gitignore
13 13
14 - **微软官方:**https://marketplace.visualstudio.com/
15 - **Open VSX:**https://open-vsx.org/
14 + - **微软官方:**https://marketplace.visualstudio.com/
15 + - **Open VSX:**https://open-vsx.org/

install(file created)

@@ -0,0 +1,68 @@
1 + #!/usr/bin/env bash
2 +
3 + BASE_URL="https://gist.asfd.cn/jetsung/vscode/raw/HEAD/"
4 + LIST_FILE="install.txt" # 默认列表文件
5 + IDE_CMD="code" # 默认 VSCode
6 + FORCE=false
7 + EXTRA=""
8 +
9 + # 参数解析函数
10 + parameters() {
11 + while getopts "s:f e:n:" opt; do
12 + case $opt in
13 + s) IDE_CMD="$OPTARG" ;;
14 + f) FORCE=true ;;
15 + e) EXTRA="$OPTARG" ;;
16 + n) LIST_FILE="$OPTARG" ;;
17 + \?) echo "无效参数: -$OPTARG" >&2; exit 1 ;;
18 + esac
19 + done
20 + shift $((OPTIND-1))
21 +
22 + # 剩余所有参数追加到 EXTRA
23 + EXTRA="$EXTRA $@"
24 + }
25 +
26 + # 主函数
27 + main() {
28 + parameters "$@"
29 +
30 + # 处理 LIST_FILE:如果不包含 . 则自动添加 .txt(除非是 *.*)
31 + if [[ "$LIST_FILE" != "*.*" ]] && [[ "$LIST_FILE" != *.* ]]; then
32 + LIST_FILE="${LIST_FILE}.txt"
33 + fi
34 +
35 + URL="${BASE_URL}${LIST_FILE}"
36 +
37 + echo "从 $URL 下载扩展列表..."
38 + EXTENSIONS=$(curl -s --fail "$URL" | grep -v '^#' | grep -v '^$' | sed '/^$/d')
39 +
40 + if [ -z "$EXTENSIONS" ]; then
41 + echo "错误: 未获取到扩展列表或文件为空!请检查文件名(当前: $LIST_FILE)。" >&2
42 + exit 1
43 + fi
44 +
45 + BASE_CMD="$IDE_CMD --install-extension"
46 +
47 + # 添加 --force
48 + if $FORCE; then
49 + EXTRA="--force $EXTRA"
50 + fi
51 +
52 + echo "开始为 $IDE_CMD 安装扩展(命令: $BASE_CMD ... $EXTRA)"
53 + echo "扩展列表:"
54 + echo "$EXTENSIONS" | tr ' ' '\n' # 美化显示,每行一个
55 + echo "-----------------"
56 +
57 + # 遍历安装(处理行内空格分隔或多行)
58 + echo "$EXTENSIONS" | tr ' ' '\n' | while read -r ext; do
59 + [ -z "$ext" ] && continue
60 + echo "安装: $ext"
61 + $BASE_CMD "$ext" $EXTRA || echo "警告: 安装 $ext 失败(可能已安装或 ID 不兼容)"
62 + done
63 +
64 + echo "-----------------"
65 + echo "所有扩展安装完成!请重启 IDE 以生效。"
66 + }
67 +
68 + main "$@"

jetsung revised this gist 5 months ago. Go to revision

2 files changed, 3 insertions

README.md

@@ -10,3 +10,6 @@
10 10 [6]:https://github.com/tamasfe/taplo
11 11 [7]:https://github.com/ultram4rine/vscode-choosealicense
12 12 [8]:https://github.com/CodeZombieCH/vscode-gitignore
13 +
14 + **微软官方:**https://marketplace.visualstudio.com/
15 + **Open VSX:**https://open-vsx.org/

ext.txt renamed to index.txt

File renamed without changes

jetsung revised this gist 5 months ago. Go to revision

2 files changed, 15 insertions, 2 deletions

README.md(file created)

@@ -0,0 +1,12 @@
1 + # VS Code 扩展推荐
2 +
3 + ## 扩展列表
4 + | 名称 | 扩展 ID (官方) | 扩展 ID() | 描述 |
5 + |:---|:---|:---|:---|
6 + | [**Even Better TOML**][6] | `tamasfe.even-better-toml` | - | 功能齐全的 TOML 支持 |
7 + | [**Choose a License**][7] | `ultram4rine.vscode-choosealicense` | - | 为你的项目选择一个许可证 |
8 + | [**gitignore**][8] | `codezombiech.gitignore` | `codezombiech.gitignore` | - | 从 https://github.com/github/gitignore 仓库拉取 .gitignore 模板。支持.gitignore 文件的语言。 |
9 +
10 + [6]:https://github.com/tamasfe/taplo
11 + [7]:https://github.com/ultram4rine/vscode-choosealicense
12 + [8]:https://github.com/CodeZombieCH/vscode-gitignore

ext.txt

@@ -1,2 +1,3 @@
1 - ultram4rine.vscode-choosealicense # 开源许可证
2 - codezombiech.gitignore # .gitignore 模板
1 + tamasfe.even-better-toml
2 + ultram4rine.vscode-choosealicense
3 + codezombiech.gitignore

jetsung revised this gist 6 months ago. Go to revision

1 file changed, 2 insertions

ext.txt(file created)

@@ -0,0 +1,2 @@
1 + ultram4rine.vscode-choosealicense # 开源许可证
2 + codezombiech.gitignore # .gitignore 模板
Newer Older