Repository navigation
fix(core): 删除无调用方的代码并修正仍按双客户端描述的注释和文档 - #258
Merged
Merged
Conversation
- 删除没有调用方的命令名单、函数和常量:AGENT_COMMANDS、 AGENT_SESSION_COMMANDS、AGENT_LIBRARY_COMMANDS、AGENT_PROVIDER_COMMANDS、 core::start_lsp_owned、lsp_engine::start_server_owned、 is_hidden_directory_name、CHANNEL_ROOTS、DIAGNOSTIC_DURATION_MS、 KNOWN_PLATFORMS、LIFECYCLE_EVENTS、devcontainer_up_with - 去掉两个未使用的依赖:agent-runtime 的 lithe-plugin-model、 core 的 lithe-plugin-ui - 注释和文档里“两个宿主”“Windows 前端”等说法改为当前的单一桌面端 - rust-core-api.md 的 C ABI 清单补上 lithe_core_is_plain_text 和 lithe_core_execute_document_json,并指向头文件 Refs 1lck/Lithe-IDEA#2651
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#2651 登记的是删除旧客户端之后 Core 里需要单独设计才能处理的部分(桌面端不再调用的命令的去留、仅测试使用的生产接口、契约文档按单客户端重写)。本 PR 只做同一次扫描里可以直接处理、不改变行为的部分,不关闭它。桌面端一侧的对应清理在 1lck/Lithe-IDEA#2652。
背景
删除 Swift、Tauri 两个旧客户端之后,Core 里留下两类东西:没有任何调用方的公开常量和函数;注释和文档里仍按“macOS SwiftUI + Windows Tauri 两个宿主”描述的说法。现在只有一个 Go 桌面端通过 cgo 链接 Core,这些说法会让读代码的人去找不存在的调用方。
共 38 个文件,+45 / −175。没有行为变化,没有协议、契约或能力版本变化。
改动
1. 删除没有调用方的代码
每一项都在 Core 仓库和桌面端仓库(1lck/Lithe-IDEA 的
desktop/)里搜索过,确认没有调用方,包括测试和按字符串分发的调用。rust/crates/agent-runtime/src/lib.rsAGENT_COMMANDS、AGENT_SESSION_COMMANDS、AGENT_LIBRARY_COMMANDS、AGENT_PROVIDER_COMMANDS。命令分发不读这些名单,删掉不影响任何命令rust/crates/core/src/lib.rsstart_lsp_ownedrust/crates/lsp-engine/src/lib.rsstart_server_ownedrust/crates/core-rules/src/visibility.rsis_hidden_directory_namerust/crates/diagnostics/src/channel.rsCHANNEL_ROOTSrust/crates/diagnostics/src/logging.rsDIAGNOSTIC_DURATION_MSrust/crates/plugin-marketplace/src/lib.rsKNOWN_PLATFORMSrust/crates/remote/src/failure_log.rsLIFECYCLE_EVENTSrust/crates/workspace/src/test_support.rsdevcontainer_up_with2. 去掉两个未使用的依赖
rust/crates/agent-runtime/Cargo.toml:lithe-plugin-modelrust/crates/core/Cargo.toml:lithe-plugin-uirust/Cargo.lock随之少两行,没有版本变化。3. 注释里按双客户端描述的说法
只改注释和测试里的注释,不改代码。“both hosts / two hosts / both products / either platform”改为“every host / a host”;“so the Windows frontend can run it synchronously”这类已不成立的理由删除;
NSTextView、“JavaScript string indices”这类指向旧客户端实现的说法改为与宿主无关的描述。涉及的文件:build/src/test_outcome.rs、build/src/test_outcome_merge.rs、core-rules/src/editor/workbench_state.rs、core/src/protocol/command.rs、core/src/tests/declarative_plugins.rs、debug/src/variable_paging.rs、diagnostics/src/logging.rs、diff/src/tests.rs、editor/src/line_edit.rs、git-host/src/lib.rs、git/src/branch_names.rs、git/src/graph.rs、git/src/lib.rs、network/src/lib.rs、plugin-manifest/src/lib.rs、plugin-manifest/src/views.rs、plugin-model/src/lib.rs、plugin-model/src/settings.rs、process/src/inventory.rs、process/src/lifecycle.rs、project/src/encoding.rs、request-context/src/events.rs、vcs/src/model.rs(都在rust/crates/下)。4. 文档
rust/contracts/rust-core-api.md:开头从“macOS SwiftUI 和 Windows React/Tauri 共用,macOS 走 C ABI、Tauri 直接链接 crate”改为“Go 桌面端通过 cgo 链接staticlib并调用 C ABI”;C ABI 清单补上头文件里已有、文档漏掉的lithe_core_is_plain_text和lithe_core_execute_document_json;删掉已不存在的macos/Sources/LitheRustCore/桥接说明,保留对rust/crates/core/include/lithe_core.h的指向。README.md(中英两处):官方 SDK 列表从sdk/{node,java,rust}改为实际的sdk/{rust,go,node,java}。rust/logging/README.md:“Sparkle differential-update baselines”改为“Viva incremental-patch baselines”。shared/plugins/contract/v1/README.md:“one Monaco undo step”改为“one editor undo step”。只改措辞,没有改任何方法、参数、返回值或行为,所以没有在插件协议更新记录里加条目。不在本 PR 范围内
PINNED_CORE_REVISION没有改;本 PR 合入后桌面端不需要为它升级固定版本。验证
在 macOS arm64 上,基于变基到
main(5dfe7970,含 #257)之后的提交运行:cargo fmt --checkcargo clippy --locked --workspace --all-targets --all-features -- -D warningscargo clippy --locked --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warningscargo test --locked --workspace --all-features --no-fail-fastlithe-core的plugin_sdk_build(2 个测试)失败,见下node scripts/logging/generate-log-events.mjs --checknode scripts/rust-core/verify-platform-tests.mjsscripts/rust-core/verify-rust-core-comments.shnode shared/plugins/scripts/verify-docs.mjs没有通过或没有运行的检查:
plugin_sdk_build的两个测试(node_sdk_serves_native_build_test_and_run_workflows、java_sdk_serves_native_build_test_and_run_workflows)在直接运行cargo test --workspace时失败:它们需要shared/plugins/scripts/sdk-e2e.mjs准备的环境变量。在没有本 PR 改动的main上同样失败,与本 PR 无关。node shared/plugins/scripts/sdk-e2e.mjs没有运行:本 PR 没有改插件后端协议。