Repository navigation
docs: 同步插件契约到 #1595 并新增插件后端工作区指南 - #6
Merged
Merged
Conversation
…ce guide - Sync contract/v1 to 1lck/Lithe-IDEA@f20601ee6 (PR #1595 head): backend 2 workspace contexts, plugin-function protocol 3 (getCapabilities, workspace service, host notifications, typed host failures, unsupportedOption with details.option, the "extend version 3 additively" rule), plus the build provider and debug adapter contract changes merged into preview since 32021a86f. - Add guides/plugin-backend-workspace.md: manifest, start triggers, negotiating version 3, capability discovery, contexts, notifications, failure codes, and the four rules a version 3 backend follows. - List the guide in the README tutorials.
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.
配合 1lck/Lithe-IDEA#1595(插件后端工作区上下文与宿主服务)同步契约,并补开发者指南。
1. 契约同步(
contract/v1、contract.lock.json)node scripts/contract.mjs sync --revision f20601ee6194f32d597031556ea628de586ac2e2同步,固定到 #1595 的当前 head。原来固定的是32021a86f。requires.backend: 2:可以不经页面启动,启动方式有onWorkspaceOpen、onCommand、网页工具窗口;新增workspace.metadata权限。getCapabilities、subscriptions/dispose、workspace/listContexts|getContext|getFolders,函数调用的params.context。didChangeContexts、commands/didRun、subscriptions/notify。-32010~-32021和details。-32018plugin.host.unsupportedOption,details.option指明是哪个字段。32021a86f以来已合入的契约变化也一并进来:构建提供者的执行、测试、运行与调试准备、只读模型输入,以及调试适配器的补充用例和多个新 fixture。2. 新指南
guides/plugin-backend-workspace.mdrequires.backend、litheFunctions.version、getCapabilities.services。getCapabilities的应答示例(取自契约 fixture)。contextExpired之后怎么重试。services列出的方法;unsupportedOption,去掉那个选项后重试;backend2 和协议 3 还没进稳定版。README 的教程表新增了这篇指南的链接。
3. 没有改的
[1, 2, 3]时会选自己支持的最高版本,不受影响。Rust SDK 的宿主错误本来就保留data.code和 JSON-RPC 号码,未知号码按一般失败处理,已经符合协议 3 对后端的要求。给 SDK 加协议 3(getCapabilities、工作区上下文、通知回调)等宿主进稳定版后单独做,避免 SDK 提前发布宿主还没提供的能力。验证(本地)
node --test scripts/*.test.mjs:0 失败。node scripts/contract.mjs verify --upstream:56 个文件与f20601ee6一致。node scripts/contract.mjs drift --ref codex/1548-plugin-host-api:无漂移。node scripts/sdk-e2e.mjs --source https://github.com/1lck/Lithe-IDEA.git --ref codex/1548-plugin-host-api:Node、Java、Rust 三个场景全部通过。node --test sdk/node/test/*.test.mjs:57 个通过。cargo test --locked --manifest-path sdk/rust/Cargo.toml:全部通过。mvn -f sdk/java/pom.xml verify:通过。