Repository navigation
fix(toolchain): 工具链候选列出 JAVA_HOME 和 PATH 上的安装 - #67
Merged
Merged
Conversation
`toolchains.candidates` 的 installations 只包含插件 provider 报告的安装和 discovery 扫描结果。插件没有为某个平台声明扫描目录时(Java 插件在 Windows 和 Linux 上就是这样),只配了 JAVA_HOME 或 PATH 的 JDK 不会出现在列表里。 新建项目的选择器因此显示“未找到已安装的版本”,设置页也无法选中它,但运行时解析 (resolve 的 environment 和 command 层)其实能找到并使用它。 - candidates 接受可选的 commandHomes(与 resolve 相同的宿主输入)。shell 行在原有 环境变量行之外,新增 PATH 命令行(带 command 字段)。 - 检查通过的 shell home 以 provider host:shell 并入 installations,按规范化 home 去重;同一个 home 已被扫描或 provider 报告时,保留原来的归属。 - selected(自动层的选择)不变:shell home 只是可选项,不参与自动层的选择。 Refs 1lck/Lithe-IDEA#2032 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 16, 2026
fix(java): discover JDKs in the standard Windows and Linux locations
Lithe-IDEA/lithe-plugin-java#17
Merged
…tes-command-homes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue:1lck/Lithe-IDEA#2032(Windows 上新建项目找不到 Temurin JDK)
问题
toolchains.candidates的installations只包含插件 provider 报告的安装和 discovery 扫描结果。插件没有为当前平台声明扫描目录时,只通过JAVA_HOME或 PATH 能找到的工具不在列表里:toolchains.resolve的 environment/command 层)能找到并使用同一个 JDK,界面和实际行为不一致。已在 Windows 11 虚拟机上用 Lithe 0.8.0 正式版复现:JDK 在
C:\Program Files\Java\Temurin\jdk-17.0.21+9,配置在 PATH 上,JAVA_HOME设与不设结果相同。改动
candidates新增可选输入commandHomes。字段形状与resolve已有的同名输入相同,由宿主报告 PATH 上找到的命令所在的 home。shell行在原有环境变量行之外,新增 PATH 命令行(带command字段,没有variable)。host:shell并入installations,按规范化 home 去重(Windows 不区分大小写)。同一个 home 已被扫描或 provider 报告时,保留原来的归属。selected(自动层的选择)、skipped和conflicts不变:shell home 只作为可选项,不参与自动层的选择。rust/contracts/rust-core-api.md中toolchains.candidates的说明。消费者:Lithe-IDEA 桌面端的工具链加载(设置页、新建项目、运行配置编辑器),会在对应 PR 里传入
commandHomes,并升级PINNED_CORE_REVISION。仓库内其他调用方只有 dispatcher 和测试。新字段是可选的,旧宿主不传时行为不变。验证
toolchain_candidates_offer_shell_homes_that_no_discovery_scan_covers,覆盖 JAVA_HOME 和 PATH 列出、同一 home 去重、扫描归属优先、版本不满足时不列出、非法commandHomes被拒。修复前该测试失败,返回plugin.toolchain.invalidParams;修复后通过。cargo test -p lithe-core --lib:822 passed。cargo test -p lithe-toolchain:通过。cargo clippy -p lithe-toolchain -p lithe-core --all-targets -- -D warnings:通过。scripts/rust-core/verify-rust-core-comments.sh toolchain:通过。x86_64-pc-windows-msvc目标的 clippy(本机没装该目标)。改动不含平台分支,交给 CI。🤖 Generated with Claude Code