jetsung revised this gist 4 months ago. Go to revision
1 file changed, 6 insertions
install renamed to install.sh
| @@ -1,5 +1,11 @@ | |||
| 1 | 1 | #!/usr/bin/env bash | |
| 2 | 2 | ||
| 3 | + | if [[ -n "${DEBUG:-}" ]]; then | |
| 4 | + | set -eux | |
| 5 | + | else | |
| 6 | + | set -euo pipefail | |
| 7 | + | fi | |
| 8 | + | ||
| 3 | 9 | BASE_URL="https://gist.asfd.cn/jetsung/vscode/raw/HEAD/" | |
| 4 | 10 | LIST_FILE="index.txt" # 默认扩展 ID 列表文件 | |
| 5 | 11 | DESC_FILE="README.md" # 描述 Markdown 文件 | |
jetsung revised this gist 4 months ago. Go to revision
1 file changed, 11 insertions
README.md
| @@ -3,6 +3,17 @@ | |||
| 3 | 3 | - **微软官方:** https://marketplace.visualstudio.com/ | |
| 4 | 4 | - **Open VSX:** https://open-vsx.org/ | |
| 5 | 5 | ||
| 6 | + | ## 教程 | |
| 7 | + | - VSCode | |
| 8 | + | ```bash | |
| 9 | + | curl -L https://gist.asfd.cn/jetsung/vscode/raw/HEAD/install | bash | |
| 10 | + | ``` | |
| 11 | + | ||
| 12 | + | - 其它 | |
| 13 | + | ```bash | |
| 14 | + | curl -L https://gist.asfd.cn/jetsung/vscode/raw/HEAD/install | bash -s -- -s kiro | |
| 15 | + | ``` | |
| 16 | + | ||
| 6 | 17 | ## 扩展列表 | |
| 7 | 18 | | 名称 | 扩展 ID | 链接 | 描述 | | |
| 8 | 19 | |:---|:---|:---|:---| | |
jetsung revised this gist 4 months ago. Go to revision
1 file changed, 1 insertion, 1 deletion
README.md
| @@ -9,7 +9,7 @@ | |||
| 9 | 9 | | [**Even Better TOML**][6] | `tamasfe.even-better-toml` | [VSCode][6-1] - [OpenVSX][6-2] | 功能齐全的 TOML 支持 | | |
| 10 | 10 | | [**Choose a License**][7] | `ultram4rine.vscode-choosealicense` | [VSCode][7-1] - [OpenVSX][7-2] | 为你的项目选择一个许可证 | | |
| 11 | 11 | | [**gitignore**][8] | `codezombiech.gitignore` | [VSCode][8-1] - [OpenVSX][8-2] | 从 https://github.com/github/gitignore 仓库拉取 .gitignore 模板。支持.gitignore 文件的语言。 | | |
| 12 | - | | [**ShellCheck**][9] | `timonwong.shellcheck` [VSCode][9-1] - [OpenVSX][9-2] | 用于 Shell 脚本的代码检查工具。 | | |
| 12 | + | | [**ShellCheck**][9] | `timonwong.shellcheck` | [VSCode][9-1] - [OpenVSX][9-2] | 用于 Shell 脚本的代码检查工具。 | | |
| 13 | 13 | ||
| 14 | 14 | [6]:https://github.com/tamasfe/taplo | |
| 15 | 15 | [6-1]:https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml | |
jetsung revised this gist 4 months ago. Go to revision
2 files changed, 8 insertions, 2 deletions
README.md
| @@ -1,11 +1,15 @@ | |||
| 1 | 1 | # VS Code 扩展推荐 | |
| 2 | 2 | ||
| 3 | + | - **微软官方:** https://marketplace.visualstudio.com/ | |
| 4 | + | - **Open VSX:** https://open-vsx.org/ | |
| 5 | + | ||
| 3 | 6 | ## 扩展列表 | |
| 4 | 7 | | 名称 | 扩展 ID | 链接 | 描述 | | |
| 5 | 8 | |:---|:---|:---|:---| | |
| 6 | 9 | | [**Even Better TOML**][6] | `tamasfe.even-better-toml` | [VSCode][6-1] - [OpenVSX][6-2] | 功能齐全的 TOML 支持 | | |
| 7 | 10 | | [**Choose a License**][7] | `ultram4rine.vscode-choosealicense` | [VSCode][7-1] - [OpenVSX][7-2] | 为你的项目选择一个许可证 | | |
| 8 | 11 | | [**gitignore**][8] | `codezombiech.gitignore` | [VSCode][8-1] - [OpenVSX][8-2] | 从 https://github.com/github/gitignore 仓库拉取 .gitignore 模板。支持.gitignore 文件的语言。 | | |
| 12 | + | | [**ShellCheck**][9] | `timonwong.shellcheck` [VSCode][9-1] - [OpenVSX][9-2] | 用于 Shell 脚本的代码检查工具。 | | |
| 9 | 13 | ||
| 10 | 14 | [6]:https://github.com/tamasfe/taplo | |
| 11 | 15 | [6-1]:https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml | |
| @@ -19,5 +23,6 @@ | |||
| 19 | 23 | [8-1]:https://marketplace.visualstudio.com/items?itemName=codezombiech.gitignore | |
| 20 | 24 | [8-2]:https://open-vsx.org/extension/codezombiech/gitignore | |
| 21 | 25 | ||
| 22 | - | - **微软官方:** https://marketplace.visualstudio.com/ | |
| 23 | - | - **Open VSX:** https://open-vsx.org/ | |
| 26 | + | [9]:https://github.com/vscode-shellcheck/vscode-shellcheck | |
| 27 | + | [9-1]:https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck | |
| 28 | + | [9-2]:https://open-vsx.org/extension/timonwong/shellcheck | |
index.txt
| @@ -1,3 +1,4 @@ | |||
| 1 | 1 | tamasfe.even-better-toml | |
| 2 | 2 | ultram4rine.vscode-choosealicense | |
| 3 | 3 | codezombiech.gitignore | |
| 4 | + | timonwong.shellcheck | |
jetsung revised this gist 5 months ago. Go to revision
1 file changed, 1 insertion, 1 deletion
install
| @@ -57,7 +57,7 @@ if $VERBOSE; then | |||
| 57 | 57 | # === 扩展 ID:严格清理空格和反引号 === | |
| 58 | 58 | id = fields[3] | |
| 59 | 59 | gsub(/^[ \t\n\r]+|[ \t\n\r]+$/, "", id) # 去除前后空白 | |
| 60 | - | gsub(/`/g, "", id) # 去除所有反引号 | |
| 60 | + | gsub(/`/, "", id) # 去除所有反引号 | |
| 61 | 61 | ||
| 62 | 62 | # === 描述 === | |
| 63 | 63 | desc = fields[5] | |
jetsung revised this gist 5 months ago. Go to revision
1 file changed, 11 insertions, 12 deletions
install
| @@ -44,7 +44,7 @@ if $VERBOSE; then | |||
| 44 | 44 | ||
| 45 | 45 | # === 名称 === | |
| 46 | 46 | name_raw = fields[2] | |
| 47 | - | gsub(/^[ \t]+|[ \t]+$/, "", name_raw) | |
| 47 | + | gsub(/^[ \t\n\r]+|[ \t\n\r]+$/, "", name_raw) | |
| 48 | 48 | if (match(name_raw, /\*\*([^*]+)\*\*/)) { | |
| 49 | 49 | name = substr(name_raw, RSTART + 2, RLENGTH - 4) | |
| 50 | 50 | } else if (match(name_raw, /^\[([^]]+)\]/)) { | |
| @@ -52,33 +52,32 @@ if $VERBOSE; then | |||
| 52 | 52 | } else { | |
| 53 | 53 | name = name_raw | |
| 54 | 54 | } | |
| 55 | - | gsub(/^[ \t]+|[ \t]+$/, "", name) | |
| 55 | + | gsub(/^[ \t\n\r]+|[ \t\n\r]+$/, "", name) | |
| 56 | 56 | ||
| 57 | - | # === 扩展 ID(去除反引号)=== | |
| 57 | + | # === 扩展 ID:严格清理空格和反引号 === | |
| 58 | 58 | id = fields[3] | |
| 59 | - | gsub(/^[ \t]+|[ \t]+$/, "", id) | |
| 60 | - | gsub(/`/g, "", id) | |
| 59 | + | gsub(/^[ \t\n\r]+|[ \t\n\r]+$/, "", id) # 去除前后空白 | |
| 60 | + | gsub(/`/g, "", id) # 去除所有反引号 | |
| 61 | 61 | ||
| 62 | 62 | # === 描述 === | |
| 63 | 63 | desc = fields[5] | |
| 64 | - | gsub(/^[ \t]+|[ \t]+$/, "", desc) | |
| 64 | + | gsub(/^[ \t\n\r]+|[ \t\n\r]+$/, "", desc) | |
| 65 | 65 | ||
| 66 | 66 | if (name == "" || id == "" || desc == "") next | |
| 67 | 67 | ||
| 68 | - | # === 生成链接 === | |
| 68 | + | # === 生成链接(确保 id 是干净的)=== | |
| 69 | 69 | split(id, parts, ".") | |
| 70 | 70 | if (length(parts) < 2) next | |
| 71 | 71 | publisher = parts[1] | |
| 72 | - | ext_name = "" | |
| 73 | - | for (i = 2; i <= length(parts); i++) { | |
| 74 | - | if (i > 2) ext_name = ext_name "." | |
| 75 | - | ext_name = ext_name parts[i] | |
| 72 | + | ext_name = parts[2] | |
| 73 | + | for (i = 3; i <= length(parts); i++) { | |
| 74 | + | ext_name = ext_name "." parts[i] | |
| 76 | 75 | } | |
| 77 | 76 | ||
| 78 | 77 | vscode_url = "https://marketplace.visualstudio.com/items?itemName=" id | |
| 79 | 78 | openvsx_url = "https://open-vsx.org/extension/" publisher "/" ext_name | |
| 80 | 79 | ||
| 81 | - | # ✅ 关键:这里不加任何反引号或多余空格 | |
| 80 | + | # ✅ 关键:这里绝不手动添加反引号或空格! | |
| 82 | 81 | printf "名称: %s\n扩展ID: %s\n描述: %s\nVSCode: %s\nOpenVSX: %s\n\n", \ | |
| 83 | 82 | name, id, desc, vscode_url, openvsx_url | |
| 84 | 83 | }' | |
jetsung revised this gist 5 months ago. Go to revision
No changes
jetsung revised this gist 5 months ago. Go to revision
1 file changed, 2 insertions, 3 deletions
install
| @@ -38,7 +38,6 @@ fi | |||
| 38 | 38 | if $VERBOSE; then | |
| 39 | 39 | echo | |
| 40 | 40 | curl -s --fail "$URL_DESC" | awk ' | |
| 41 | - | # 匹配数据行:以 | [ 开头,且包含反引号 ID | |
| 42 | 41 | /^\| \[/ && /\| `[^`]+` \|/ { | |
| 43 | 42 | split($0, fields, "\\|") | |
| 44 | 43 | if (length(fields) < 6) next | |
| @@ -55,7 +54,7 @@ if $VERBOSE; then | |||
| 55 | 54 | } | |
| 56 | 55 | gsub(/^[ \t]+|[ \t]+$/, "", name) | |
| 57 | 56 | ||
| 58 | - | # === 扩展 ID === | |
| 57 | + | # === 扩展 ID(去除反引号)=== | |
| 59 | 58 | id = fields[3] | |
| 60 | 59 | gsub(/^[ \t]+|[ \t]+$/, "", id) | |
| 61 | 60 | gsub(/`/g, "", id) | |
| @@ -67,7 +66,6 @@ if $VERBOSE; then | |||
| 67 | 66 | if (name == "" || id == "" || desc == "") next | |
| 68 | 67 | ||
| 69 | 68 | # === 生成链接 === | |
| 70 | - | # 拆分 publisher.extension | |
| 71 | 69 | split(id, parts, ".") | |
| 72 | 70 | if (length(parts) < 2) next | |
| 73 | 71 | publisher = parts[1] | |
| @@ -80,6 +78,7 @@ if $VERBOSE; then | |||
| 80 | 78 | vscode_url = "https://marketplace.visualstudio.com/items?itemName=" id | |
| 81 | 79 | openvsx_url = "https://open-vsx.org/extension/" publisher "/" ext_name | |
| 82 | 80 | ||
| 81 | + | # ✅ 关键:这里不加任何反引号或多余空格 | |
| 83 | 82 | printf "名称: %s\n扩展ID: %s\n描述: %s\nVSCode: %s\nOpenVSX: %s\n\n", \ | |
| 84 | 83 | name, id, desc, vscode_url, openvsx_url | |
| 85 | 84 | }' | |
jetsung revised this gist 5 months ago. Go to revision
1 file changed, 24 insertions, 14 deletions
install
| @@ -38,40 +38,50 @@ fi | |||
| 38 | 38 | if $VERBOSE; then | |
| 39 | 39 | echo | |
| 40 | 40 | curl -s --fail "$URL_DESC" | awk ' | |
| 41 | - | # 只处理看起来像扩展数据行的行:以 | [ 开头,且包含反引号 ID | |
| 41 | + | # 匹配数据行:以 | [ 开头,且包含反引号 ID | |
| 42 | 42 | /^\| \[/ && /\| `[^`]+` \|/ { | |
| 43 | - | # 按 | 分割 | |
| 44 | 43 | split($0, fields, "\\|") | |
| 45 | 44 | if (length(fields) < 6) next | |
| 46 | 45 | ||
| 47 | - | # === 提取名称(fields[2])=== | |
| 46 | + | # === 名称 === | |
| 48 | 47 | name_raw = fields[2] | |
| 49 | 48 | gsub(/^[ \t]+|[ \t]+$/, "", name_raw) | |
| 50 | - | # 提取 **...** 中的内容 | |
| 51 | 49 | if (match(name_raw, /\*\*([^*]+)\*\*/)) { | |
| 52 | 50 | name = substr(name_raw, RSTART + 2, RLENGTH - 4) | |
| 51 | + | } else if (match(name_raw, /^\[([^]]+)\]/)) { | |
| 52 | + | name = substr(name_raw, RSTART + 1, RLENGTH - 2) | |
| 53 | 53 | } else { | |
| 54 | - | # 如果没有加粗,尝试提取 [text][ref] 中的 text | |
| 55 | - | if (match(name_raw, /^\[([^]]+)\]/)) { | |
| 56 | - | name = substr(name_raw, RSTART + 1, RLENGTH - 2) | |
| 57 | - | } else { | |
| 58 | - | name = name_ | |
| 59 | - | } | |
| 54 | + | name = name_raw | |
| 60 | 55 | } | |
| 56 | + | gsub(/^[ \t]+|[ \t]+$/, "", name) | |
| 61 | 57 | ||
| 62 | - | # === 提取扩展 ID(fields[3])=== | |
| 58 | + | # === 扩展 ID === | |
| 63 | 59 | id = fields[3] | |
| 64 | 60 | gsub(/^[ \t]+|[ \t]+$/, "", id) | |
| 65 | 61 | gsub(/`/g, "", id) | |
| 66 | 62 | ||
| 67 | - | # === 提取描述(fields[5])=== | |
| 63 | + | # === 描述 === | |
| 68 | 64 | desc = fields[5] | |
| 69 | 65 | gsub(/^[ \t]+|[ \t]+$/, "", desc) | |
| 70 | 66 | ||
| 71 | - | # 跳过空值 | |
| 72 | 67 | if (name == "" || id == "" || desc == "") next | |
| 73 | 68 | ||
| 74 | - | printf "名称: %s\n扩展ID: %s\n描述: %s\n\n", name, id, desc | |
| 69 | + | # === 生成链接 === | |
| 70 | + | # 拆分 publisher.extension | |
| 71 | + | split(id, parts, ".") | |
| 72 | + | if (length(parts) < 2) next | |
| 73 | + | publisher = parts[1] | |
| 74 | + | ext_name = "" | |
| 75 | + | for (i = 2; i <= length(parts); i++) { | |
| 76 | + | if (i > 2) ext_name = ext_name "." | |
| 77 | + | ext_name = ext_name parts[i] | |
| 78 | + | } | |
| 79 | + | ||
| 80 | + | vscode_url = "https://marketplace.visualstudio.com/items?itemName=" id | |
| 81 | + | openvsx_url = "https://open-vsx.org/extension/" publisher "/" ext_name | |
| 82 | + | ||
| 83 | + | printf "名称: %s\n扩展ID: %s\n描述: %s\nVSCode: %s\nOpenVSX: %s\n\n", \ | |
| 84 | + | name, id, desc, vscode_url, openvsx_url | |
| 75 | 85 | }' | |
| 76 | 86 | echo | |
| 77 | 87 | exit 0 | |
jetsung revised this gist 5 months ago. Go to revision
1 file changed, 1 insertion, 1 deletion
install
| @@ -1,6 +1,6 @@ | |||
| 1 | 1 | #!/usr/bin/env bash | |
| 2 | 2 | ||
| 3 | - | BASE_URL="https://gist.asfd.cn/jetsung/vscode/raw/HEAD/ " | |
| 3 | + | BASE_URL="https://gist.asfd.cn/jetsung/vscode/raw/HEAD/" | |
| 4 | 4 | LIST_FILE="index.txt" # 默认扩展 ID 列表文件 | |
| 5 | 5 | DESC_FILE="README.md" # 描述 Markdown 文件 | |
| 6 | 6 | IDE_CMD="code" # 默认 VSCode | |