Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions rust/crates/build/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,13 @@ pub(crate) fn describe_with_facts(
if let Some(description) = &option.description {
entry["description"] = json!(description);
}
if source == "unset" && option.is_text_like() {
if option.default.is_none() && option.is_text_like() {
// What the tool uses while the option is unset, as the model
// reported it (Maven's user settings file, its local
// repository). Display only: it contributes no argument, so
// the tool keeps deciding when its own configuration changes.
// repository), also while the user overrides it: it is what
// removing the override returns to. Display only: it
// contributes no argument, so the tool keeps deciding when its
// own configuration changes. A declared default replaces it.
if let Some(value) = facts
.defaults
.and_then(|map| map.get(&option.id))
Expand Down
7 changes: 4 additions & 3 deletions rust/crates/core/src/tests/build_systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3450,8 +3450,8 @@ fn model_option_defaults_and_exclusions_round_trip_through_storage_and_plans() {
/// A model reports what the tool uses for a text, file or directory option
/// the user left unset (Maven's user settings file and local repository), as
/// IDEA shows the effective path greyed out until the user overrides it. The
/// value is display only: it contributes no argument, and a user value or a
/// declared default replaces it.
/// value is display only: it contributes no argument, it stays beside a user
/// value as what removing it returns to, and a declared default replaces it.
#[test]
fn model_reports_the_implicit_value_of_unset_path_options() {
let workspace = TemporaryWorkspace::new("model-implicit-values");
Expand Down Expand Up @@ -3540,7 +3540,8 @@ fn model_reports_the_implicit_value_of_unset_path_options() {
let settings = by_id(&overridden, "settingsFile");
assert_eq!(settings["source"], "user");
assert_eq!(settings["value"], "/work/settings.xml");
assert!(settings.get("implicitValue").is_none(), "{settings}");
// What removing the override returns to stays shown beside it.
assert_eq!(settings["implicitValue"], "/home/me/.m2/settings.xml");
}

/// A model map may fill `optionDefaults` for choicesFromModel, text, file and
Expand Down
6 changes: 4 additions & 2 deletions shared/plugins/contract/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2988,8 +2988,10 @@ every time. `build.detect` walks the workspace once for all enabled plugins
and returns instances, with the model of `static` sources. `build.invocationPlan` and `build.checkToolVersion` resolve the
executable; `build.resolveOptions` checks stored option values and returns
each option's value, `source` (`user`, `default` or `unset`), choices,
`description`, and, for an unset `text`, `file` or `directory` option, the
`implicitValue` the loaded model reported, with the configuration fingerprint; `build.modelPlan`, `build.taskPlan`,
`description`, and, for a `text`, `file` or `directory` option without a
declared `default`, the `implicitValue` the loaded model reported (also while
the user overrides it, as what removing the value returns to), with the
configuration fingerprint; `build.modelPlan`, `build.taskPlan`,
`build.testPlan`, and `build.dependencyPlan` return argv plans, or provider
requests for a provider source;
`build.decodeModel`, `build.decodeTestResults`, `build.decodeDiagnostics`,
Expand Down
1 change: 1 addition & 0 deletions shared/plugins/reference/protocol-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@

| PR | 修改人 | API 编号 | 协议 / 能力 | 改了什么 |
| --- | --- | --- | --- | --- |
| [#121](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/121) | [@1lck](https://github.com/1lck) | API-29 | `buildSystems` 0 内的行为修正 | `build.resolveOptions` 对没有声明 `default` 的 `text`、`file`、`directory` 选项,用户覆盖时也返回 `implicitValue`,作为撤销覆盖后回到的值,宿主据此保留“覆盖”复选框。没有新增字段、版本号、宿主方法或通知。见 [1lck/Lithe-IDEA#2152](https://github.com/1lck/Lithe-IDEA/issues/2152)。 |
| [#120](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/120) | [@1lck](https://github.com/1lck) | API-29 | `buildSystems` 0 内的补充 | 清单的 `options[]` 新增 `description`(1–512 字符),作为宿主 ⓘ 中的说明,只用于显示。`litheBuildModel` 和 `model.map` 的 `optionDefaults` 除 `choicesFromModel` 选项外,也可以填 `text`、`file`、`directory` 选项,值是选项未设置时工具实际使用的那一个(如 Maven 的用户设置文件和本地仓库),Core 只保留第一个值。`build.resolveOptions` 对未设置的这类选项返回 `implicitValue`,并返回 `description`。`implicitValue` 只用于显示,不生成参数,也不进入选项指纹。旧 Core 会拒绝声明了 `description` 或给路径选项填 `optionDefaults` 的清单。没有新增版本号、宿主方法、通知或 SDK 版本。见 [1lck/Lithe-IDEA#2152](https://github.com/1lck/Lithe-IDEA/issues/2152)、[#2204](https://github.com/1lck/Lithe-IDEA/issues/2204)。 |
| [#118](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/118) | [@1lck](https://github.com/1lck) | — | `buildSystems` 0 内的行为补充 | 契约新增 [Workspace trust](../contract/v1/README.md#workspace-trust) 一节,取代“Lithe 没有工作区信任状态”的说法。构建计划请求新增 `projectCodeAllowed`;工作区未受信任时,Core 以新错误码 `plugin.build.untrustedWorkspace` 拒绝所有任务、测试、运行、调试准备,以及声明了 `executesProjectCode: true` 的模型、依赖命令和构建提供者请求。声明 `false` 的模型和依赖命令在安全模式下照常加载。插件清单和后端协议都不变;宿主必须在计划请求里传入信任,否则会运行项目代码的计划都会被拒绝。没有新增版本号、宿主方法、通知或 SDK 版本。见 [1lck/Lithe-IDEA#2201](https://github.com/1lck/Lithe-IDEA/issues/2201)。 |
| [#111](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/111) | [@Mucheen](https://github.com/Mucheen) | API-23 | `toolchainProviders` 0 内的修正 | 无项目时,`toolchains.resolve` 可使用同一代次的全局提供者回包。解析目录为 `.`,查询的 `workspace` 和 `context` 显式为 `null`,解析上下文也为空。工作区查询继续校验根目录和相对目录,两种查询都核对文件系统快照及排除根。 |
Expand Down
Loading