Repository navigation
feat(plugins): 编辑器 Provider 与多车道编辑器动作(API-25、API-27) - #1730
Conversation
…5, API-27) Core 新增 plugins.editorProviders.decode(注册、结果规范化、definition 合并)并扩展 plugins.editorActions.decode 到 version 2:额外图标、alternatives、点击结果 reveal。 宿主通过 lsp.startServer hostOptions.editor 声明图标、快照上限和路由的 Provider 类型, getCapabilities 回显。未知 Provider 类型返回 unsupportedOption(-32018)。 Refs #1495
…-27) Refs #1495 - Declare the macOS editor host options (nine gutter icons, 1 MiB action source, seven provider types) and send them in the language-server start options so Core reports them through getCapabilities. - Add the editor.providers permission label and the editor service `lithe/host/editor/registerProviders`: registrations are leased per plugin context, withdrawn on function withdrawal, session end and context close, and limited to 32 per plugin. - Query matching providers concurrently with Core's per-type budgets and drop late, stale, failed or malformed answers; completion triggers only reach registrations that asked for the typed character. - Supplement go-to-definition with plugin locations through Core's merge rule; the language server's answer is never replaced. - Route editor action alternatives and the reveal result of a clicked action to the native navigation list. - Bridge code lenses, document links, hover, completion, folding ranges and semantic tokens to the web editor behind opaque per-batch keys, so plugin targets and lens parameters never come from the page.
…s (API-25, API-27) Refs #1495 - Plugin editor actions get a left lane for navigation icons and a right lane for run icons, one marker per line and lane. A click opens a menu with each action followed by its alternatives (for example Debug after Run) and posts the opaque action and alternative keys. - Add the nine icon names the macOS host offers plugins with light and dark SVGs, and check that every offered name has an SVG. - Register hover, completion, code lens, folding range, semantic token and document link providers for all languages. They only supplement the language server: semantic tokens apply where no language-specific provider exists. - Draw document links with opaque URLs of a private scheme and open them through a registered opener that asks the host, so a plugin-supplied URL (including command:) never reaches Monaco. - Keep the page rules (range conversion, hover escaping, folding limits, semantic legend merge, action markers and menus) in pure modules with unit tests.
… extension (API-25) AppModel+CodeNavigation grew to 619 lines and tripped the 600-line AppModel extension limit in verify-service-boundaries.sh. The plugin-only helpers (presenting plugin definitions, wrapping link availability) move next to pluginDefinitionQuery. The log-exempt marker for the handled decode failure now sits on the catch line, where verify-log-usage.mjs looks for it.
…(API-25, API-27) Update the plugin API plan rows for API-25/26/27, rewrite the editor extension Note around the shipped provider and action design, and register the editor providers capability in the platform feature matrix (macOS partial, Windows missing).
契约要求选择器条目不区分大小写匹配,宿主按小写比较语言 ID, Core 解码注册时把 languages 转成小写再排序去重。 同时把两处测试里的 compactMap 移出 #require,避免宏展开后报 call can throw 的编译错误。
Lithe Review结论: 未发现需要阻塞合并的问题。 Findings
Scope Check
Suggestions
Verification
|
Lithe 运行验收版本: 对照:共同祖先
未覆盖:
工作副本与运行状态已清理;可复用编译缓存按 12 GiB / 7 天预算保留。 |
- 修饰键悬停只保留最新一次插件定义查询,新悬停取消旧查询并让旧票据失效 - 只读预览不向插件询问定义,跳转前复查文档版本,结果在呈现处再确认仍然有效 - 用户可见错误改走 L10n.string - 修正 EditorHostOptions 的 rustdoc 链接 - 插件编辑器 Provider 在宿主 Provider 之前注册,悬停探针的顺序稳定
# Conflicts: # docs/development/macos-plugin-api-plan.md # rust/lithe-core/src/tests/declarative_plugins.rs # shared/platform-feature-matrix/features/plugin-editor-actions.json
- editor-providers、editor-actions-v2 fixtures 移入 fixtures/editor/,同步测试、契约脚本、README 和功能矩阵路径 - 转到定义的插件分支复用 languageServerIsPreparing,不在宿主导航代码里新增语言名 - plugin-editor-actions.ts 语言词计数降为 0,更新基线
# Conflicts: # rust/lithe-core/src/tests/declarative_plugins.rs # shared/contracts/plugins/v1/fixtures/manifest/invalid-manifests.json
- #1752 新增的 toolchain_vectors.rs 写死了 9 处工具名,Verify Host Language Specifics 在 preview 上失败 - 工具 ID 改从 fixtures/toolchains/tool-definition.plugin.json 读取,路径里的工具名换成中性的 tool - toolchain_resolution.rs 复用 MANUAL_HOME,计数 90 -> 89,基线只调低这一行
Refs #1495
做了什么
对应计划 API-25 的"后续:新 Provider"和 API-27。API-26(诊断)不在本 PR。
lithe/host/editor/registerProviders,权限editor.providers。插件可以为 definition、hover、completion、codeLens、foldingRange、semanticTokens、documentLink 注册同插件函数。
每个插件最多 32 个注册。不支持的类型返回 unsupportedOption(-32018),其余校验失败返回 invalidParams。
PluginsEditorProviderFailed日志。editor/registerActions升级到 version 2:lithe-plugin-linkURL。file:。宿主方法
lithe/host/editor/registerProviderslithe/host/editor/registerActions(version 2)alternatives、点击后reveal评审修复(lithe-code-review)
L10n.string。EditorHostOptions的 rustdoc 链接。PluginEditorProviderTests用例覆盖以上行为。同步 preview(含 #1727、#1740、#1744、#1747、#1748、#1750、#1751、#1752)
editor-providers、editor-actions-v2fixtures 移入fixtures/editor/,测试、verify-shared-contracts.sh、README 和功能矩阵里的路径同步修改。languageServerIsPreparing,不在宿主导航代码里新增语言名;plugin-editor-actions.ts的计数降到 0,基线里删掉这一项。declarative_plugins.rs的 fixture 列表、invalid-manifests.json)两边都保留。rust/lithe-core/src/tests/toolchain_vectors.rs写死了 9 处工具名,preview 的Verify Host Language Specifics从 docs(contracts): 删除工具链契约草案,已实现部分写进正式契约,测试改用内联数据 #1752 起就是红的,所有改 Rust 的 PR 都会被卡住。这里改为从共享的fixtures/toolchains/tool-definition.plugin.json读工具 ID,路径里的工具名换成中性的tool;toolchain_resolution.rs复用MANUAL_HOME,计数 90 → 89。基线只调低这一行,没有调高。行为不变,toolchain 测试全过。验证
已通过:
cargo test --lib:plugins::editor_providers、plugins::editor_actions、declarative_plugins、plugin_function、toolchainscripts/macos/test/test-macos.sh --filter 'PluginEditorProviderTests|PluginEditorActionTests|LanguageNavigationCoordinatorTests|MonacoNavigationCoordinatorTests|ExternalNavigationTests|NavigationHistoryFeatureModelTests':8 个套件 62 个测试通过PluginEditorProviderTests|PluginEditorActionTests|MonacoWorkbenchSessionLifetimeTests27 个测试、Bun 两个规则测试verify-no-host-language-specifics.mjs --base origin/preview(Ratchet verified)、verify-shared-contracts.sh、verify-log-usage.mjs、generate-i18n.mjs --check、verify-app-language-localization.mjs、rustfmtcargo check --bin lithe-windows:本 PR 没有改windows/,在 macOS 上只剩 Windows 专用文件(project_window_registry.rs)本来就有的编译错误尚未运行:
暂按默认值处理、等评审确认的问题
file:,其余 scheme 丢弃。已知未完成
node scripts/contract.mjs sync --revision <合并后的 preview commit>同步契约。在同一个 PR 里把本 PR(editorProviders新服务、editorActions: 2)登记进reference/protocol-changelog.md和 API 总表,新版本号写进"按协议查首次出现"表,并 @ 本 PR 作者核对。