diff --git a/rust/crates/plugin-model/src/settings.rs b/rust/crates/plugin-model/src/settings.rs index 8fc66ed8..6a15991e 100644 --- a/rust/crates/plugin-model/src/settings.rs +++ b/rust/crates/plugin-model/src/settings.rs @@ -145,9 +145,11 @@ pub struct SourceEditorDeclaration { pub edit_function: String, /// Optional declared build system whose native tool and stored options accompany reads. #[serde(default, skip_serializing_if = "Option::is_none")] + #[serde(rename = "buildSystemID")] pub build_system_id: Option, /// Optional declared language server made ready before a source query. #[serde(default, skip_serializing_if = "Option::is_none")] + #[serde(rename = "languageID")] pub language_id: Option, } diff --git a/rust/crates/plugin-model/src/settings/sources/tests.rs b/rust/crates/plugin-model/src/settings/sources/tests.rs index e9e67790..b4917fc5 100644 --- a/rust/crates/plugin-model/src/settings/sources/tests.rs +++ b/rust/crates/plugin-model/src/settings/sources/tests.rs @@ -164,3 +164,13 @@ fn absent_boolean_values_expose_inheritance_and_unknown_effective_values() { json!({"kind":"unknown","inherited":true}) ); } + +#[test] +fn source_editor_bindings_follow_the_public_id_field_spelling() { + let value = json!({"editFunction":"compiler.prepare","buildSystemID":"fictional","languageID":"fictional"}); + let declaration: crate::settings::SourceEditorDeclaration = + serde_json::from_value(value.clone()).unwrap(); + assert_eq!(declaration.build_system_id.as_deref(), Some("fictional")); + assert_eq!(declaration.language_id.as_deref(), Some("fictional")); + assert_eq!(serde_json::to_value(declaration).unwrap(), value); +} diff --git a/shared/plugins/contract/v1/README.md b/shared/plugins/contract/v1/README.md index e2546e2d..171071a7 100644 --- a/shared/plugins/contract/v1/README.md +++ b/shared/plugins/contract/v1/README.md @@ -644,7 +644,7 @@ Snapshot fields (unknown fields are rejected): | `groups` | 1–32 ordered `{id,title,layout,rowTitle?}` sections. `layout` is `form` or `table`; table rows use source titles in the first column and their fields as value columns. | | `sources` | At most 1024 `{id,group,title,path,revision,writable,fields}` bindings. `path` is normalized, workspace-relative, slash-separated, at most 4096 bytes and contains no empty/dot/parent components, drive letters or backslashes. Duplicate IDs or paths are rejected. Native adapters must additionally reject native file aliases and any installation resource. | | `revision` | `missing`, or `sha256:` followed by 64 lowercase hexadecimal digits covering the exact source bytes. Reading a missing source does not create it. | -| `fields` | 1–32 `{id,title,description?,kind,value,effectiveValue,inheritedValue?,effectiveSource,options?}` records per source. IDs are opaque ASCII identifiers of at most 128 bytes; labels are nonblank and at most 256 bytes, descriptions at most 2048 bytes. Only explicitly non-sensitive fields may be projected. | +| `fields` | 1–32 `{id,title,description?,kind,value,effectiveValue,inheritedValue?,effectiveSource,options?}` records per source. IDs are opaque identifiers using only lowercase ASCII letters, digits and hyphens, at most 128 bytes; labels are nonblank and at most 256 bytes, descriptions at most 2048 bytes. Only explicitly non-sensitive fields may be projected. | | Field values | `value:null` means absent/inherited. `effectiveValue` comes from the upstream tool and may also be null if there is no value. `inheritedValue` is the upstream value after removing a local override; omit it or use null when unknown. `effectiveSource` is a localized origin label of at most 1024 bytes. | | Field kinds | `enum` with 1–64 distinct `{value,title}` options; `boolean`; `text` up to 8192 bytes; `stringList` or `fileList` with at most 256 nonblank strings, each at most 4096 bytes. Non-enumeration fields omit options. `fileList` adds the host's file picker; list editing uses one item per line, preserving spaces and platform path spelling. | diff --git a/shared/plugins/reference/protocol-changelog.md b/shared/plugins/reference/protocol-changelog.md index 6fe8d7e1..060ca08e 100644 --- a/shared/plugins/reference/protocol-changelog.md +++ b/shared/plugins/reference/protocol-changelog.md @@ -137,6 +137,7 @@ | PR | 修改人 | API 编号 | 协议 / 能力 | 改了什么 | | --- | --- | --- | --- | --- | +| [#58](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/58) | [@1lck](https://github.com/1lck) | API-19 | `sourceSettings` 0 内修正 | 修正来源编辑器绑定的 serde 名称,使 `buildSystemID`、`languageID` 与公开 schema、动作计划和桌面桥接一致;往返回归覆盖读取与规范序列化。明确来源字段 ID 只允许小写 ASCII 字母、数字和连字符。未新增宿主方法。 | | [#57](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/57) | [@1lck](https://github.com/1lck) | API-19、API-29 | **`sourceSettings` 0**;`buildSystems` 0 内补充 | 原生配置来源编辑:同插件独立读取/暂存函数、编译器页、上游语言/构建上下文、实际值与移除覆盖后的继承值、严格限额、显式保存及 SHA-256 收据。Core 新增 sourceState/sourceEdit/sourceReceipt 命令,原文不跨协议。构建运行时计划返回明确候选与 pathVariable,由原生宿主先验证运行时再启动构建工具;未新增宿主 RPC 方法或通知。 | | [#56](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/56) | [@xiaoyumuxi](https://github.com/xiaoyumuxi) | API-30 | `debugAdapters` 0 内的补充 | `targetBindings.cwd` 除了 `target.workingDirectory`,也可以绑到 `target.directory`(源文件所在目录)。调试引擎在 launch 参数缺 `cwd` 时会填工作区根目录;Go 插件绑定 `cwd` ← `target.directory` 后,被调程序在包目录运行,按包目录写的相对路径能读到。其他值以 `plugin.manifest.invalid`(字段 `targetBindings.cwd`)拒绝;目标路径是裸文件名、取不出目录时以 `debug.target.invalid`(字段 `target.path`)拒绝。只是可选取值,不需要新能力版本。 | | [#55](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/55) | [@xiaoyumuxi](https://github.com/xiaoyumuxi) | API-30 | `debugAdapters` 0 内的补充 | `targetBindings` 新增 `adapterArguments`:最多 8 个只有这个适配器才有的 DAP 参数,`{"<参数路径>": "<事实>"}`,路径和 `connection` 的目标一样用点分隔、最多 4 段,事实只能是 `target.path`、`target.directory` 或 `target.workingDirectory`,和其他绑定一样只在没有值时填入。`env.<变量名>` 往环境里加一个变量,`arguments` 和 `env` 绑定给的变量都保留。例如 Delve 在 `dlvCwd` 里编译程序,不在宿主给它的工作目录(工作区根目录)里编译,`go build` 又从 `PWD` 读当前目录;Go 插件绑定 `dlvCwd` 和 `env.PWD` ← `target.directory` 后,工作区根目录没有 `go.mod`、一个工作区放了多个模块、路径经过符号链接时都能调试。路径不能从 `program`、`processId`、`cwd`、`args`、`env` 本身、`noDebug`、`__` 开头的名字开始,路径之间、路径和 `connection` 的目标之间不能重叠,也不能落在 `arguments` 已有的值上或它的下面,违反时以 `plugin.manifest.invalid`(字段 `targetBindings.adapterArguments[.<参数路径>]`)拒绝;目标缺少事实时以 `debug.target.invalid`(字段 `target.path` 或 `target.workingDirectory`)拒绝。只是可选字段,不需要新能力版本。 |