适配 ege25.11 进行一些改进, 版本号更新至 1.0.0#10
Conversation
Walkthrough将包版本升至 1.0.0,加入对 Visual Studio 2026 的识别与构建映射,新增配置项 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Installer
participant Compilers
participant Cache
participant Downloader
participant BuiltinBundle
Installer->>Compilers: 识别 VS 版本(含 VS2026)
Installer->>Cache: 检查已有安装并清理插件缓存(若存在)
alt Windows 且 downloadFromOfficial == true
Installer->>Downloader: 请求从官方站点下载 EGE
Downloader-->>Installer: 返回下载包或错误
Installer->>BuiltinBundle: 部署下载包到内置路径并完成安装
else Windows 且 downloadFromOfficial == false
Installer->>BuiltinBundle: 使用仓内内置捆绑直接安装(无用户交互)
BuiltinBundle-->>Installer: 安装完成
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/installer.ts (1)
65-85: 建议改进递归逻辑和用户体验。当前实现在 Windows 系统检测到已有安装时,会自动清理缓存并重新安装。虽然逻辑上是安全的(
clearPluginCache()会删除egeTempDir,递归调用时条件不再满足),但存在以下问题:
递归调用模式不够清晰:在 lines 74 和 80 处调用
await this.performInstall()会让代码流程难以追踪,建议重构为更直接的控制流。缺少用户提示:在清理已有安装前,应该通知用户将要执行的操作,避免用户困惑。当前只有在
clearPluginCache()内部才显示"清理缓存完成"的提示。参数行为不一致:函数的
needDownload参数在新的代码路径中被忽略,改为由downloadFromOfficial配置决定,这可能导致调用者的预期行为不一致。建议的改进方案:
async performInstall(needDownload?: boolean): Promise<boolean | undefined> { // 检查是否配置了从官网下载 const config = vscode.workspace.getConfiguration('ege'); const downloadFromOfficial = config.get<boolean>('downloadFromOfficial', false); if (fs.existsSync(this.egeInstallerDir)) { if (isWindows()) { - // 如果配置了从官网下载,直接清理缓存并下载 - if (downloadFromOfficial) { - this.clearPluginCache(); - await this.performInstall(true); - return; - } - - // 默认:直接使用内置版本,重新安装 - this.clearPluginCache(); - await this.performInstall(false); - return; + // 通知用户并清理已有安装 + const action = await vscode.window.showInformationMessage( + t('message.reinstallPrompt'), + t('button.continue'), + t('button.cancel') + ); + if (action !== t('button.continue')) { + return false; + } + this.clearPluginCache(); + // 继续执行安装流程,使用配置决定下载源 + needDownload = downloadFromOfficial; } else { ege.printInfo("正在非 Windows 系统上执行编译..."); } } + + // 如果 needDownload 未明确指定,则使用配置 + if (needDownload === undefined) { + needDownload = downloadFromOfficial; + }这样可以:
- 消除递归调用,使控制流更清晰
- 在清理前征求用户确认
- 统一
needDownload参数和配置的处理逻辑
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
CHANGELOG.md(1 hunks)README.md(2 hunks)README.zh-CN.md(2 hunks)package.json(2 hunks)package.nls.json(1 hunks)package.nls.zh-cn.json(1 hunks)src/compilers.ts(2 hunks)src/installer.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/installer.ts (1)
src/utils.ts (1)
isWindows(83-85)
🪛 LanguageTool
README.md
[grammar] ~45-~45: Ensure spelling is correct
Context: ...ial`**: By default, the plugin uses the builtin EGE library (tested and stable). If you...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🔇 Additional comments (11)
package.nls.zh-cn.json (1)
11-12: LGTM!新增的本地化配置项格式正确,中文描述清晰准确,与英文版本保持一致。
package.nls.json (1)
11-12: LGTM!英文本地化配置项添加正确,描述清晰,与中文版本保持一致。
README.zh-CN.md (2)
18-18: LGTM!正确更新了 Windows 工具链版本支持范围,包含了新增的 Visual Studio 2026+ 支持。
37-45: LGTM!新增的配置说明清晰易懂,既提供了配置示例,又详细说明了配置项的用途和注意事项。文档结构合理,有助于用户理解何时使用此选项。
CHANGELOG.md (1)
7-19: LGTM!1.0.0 版本的更新日志完整详细,清晰记录了所有重要变更,包括:
- 大版本更新(EGE 25.11)
- VS 2026 支持
- 新配置项
- 用户体验改进
- EGE 新特性列表
文档结构清晰,有助于用户了解版本变化。
src/compilers.ts (2)
27-27: LGTM!新增的 VS2026 常量定义与现有的 Visual Studio 版本常量保持一致。
276-276: LGTM!正确地将 TYPE_VS2026 添加到安装流程的 switch 语句中,与其他 Visual Studio 版本的处理方式保持一致。
README.md (2)
18-18: LGTM!正确更新了 Windows Visual Studio 版本支持范围,与中文文档保持一致。
39-45: LGTM!新增的配置项文档清晰完整,与中文版本保持一致。
注:静态分析工具关于 "builtin" 拼写的提示是误报,"builtin" 是编程领域的标准术语,表示"内置的"。
package.json (2)
5-5: LGTM!版本号正确更新至 1.0.0,符合此次大版本更新的语义化版本规范。
76-82: LGTM!新增的配置项定义规范完整:
- 类型定义正确(boolean)
- 默认值合理(false,使用内置版本)
- 使用了本地化引用
- 作用域设置恰当(resource)
JSON 格式正确,与现有配置项保持一致。
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/buildSingleFileWin32.ts (1)
114-114: 添加/Zc:__cplusplus标志是一个改进。此标志确保
__cplusplus宏正确反映所使用的 C++ 标准版本,这对于标准兼容的代码和条件编译很重要。可选的代码清理:
Line 112 的
executionCharsetCommand始终为空字符串,可以考虑从 Line 114 的构建命令中移除它以提高可读性:-const buildCommand = `call "${cmdTool}" ${arch} && cl /nodefaultlib:"MSVCRT" /MDd ${defineConsole} ${extraIncludeCommand} /std:${cppStandard} /Zc:__cplusplus ${sourceCharsetCommand} ${executionCharsetCommand} /EHsc "${filePath}" /link ${extraLibsCommand}`; +const buildCommand = `call "${cmdTool}" ${arch} && cl /nodefaultlib:"MSVCRT" /MDd ${defineConsole} ${extraIncludeCommand} /std:${cppStandard} /Zc:__cplusplus ${sourceCharsetCommand} /EHsc "${filePath}" /link ${extraLibsCommand}`;同时可以移除 Line 111-112 的
executionCharset和executionCharsetCommand变量定义。
Summary by CodeRabbit
新功能
文档
维护
✏️ Tip: You can customize this high-level summary in your review settings.