Repository navigation
feat(plugins): 新增官方 Go 插件后端 SDK,文档推荐新插件优先用 Rust 或 Go - #113
Merged
Merged
Conversation
- shared/plugins/sdk/go:模块 github.com/Lithe-IDEA/Lithe-core-rust/shared/plugins/sdk/go, 包 lithe,Go 1.22+,只用标准库。实现函数协议、宿主服务(凭据、工作区、文档与编辑器、 预览、浏览器、窗口消息、functions/providers 与 functions/invoke、原生终端、订阅)、 插件视图 View(id, handler)、litheKeymapImport 0 和结构化诊断;不实现构建和 VCS 提供者。 Unix 上把协议移到 stdout 的副本、stdout 指向 stderr;处理函数 panic 只结束该次调用, 只发固定的 panic 类别。 - 示例后端 sdk/go/examples/sample-backend 与 Rust 示例跑同一个插件后端场景; 新增 e2e 测试 plugin_sdk_go,sdk-e2e.mjs 先构建 Go 示例再运行。 - 发布方式:Go 模块标签 shared/plugins/sdk/go/v<版本>,没有版本文件和发布工作流; 这次不推送标签。 - 文档:插件总览推荐新插件优先用 Rust 或 Go SDK(构建后端用 Node.js/Java,VCS 后端用 Node.js);契约 README、日志指南、原生终端指南(补 Go 示例)、各参考页和 SDK README 把 Go 列进官方 SDK;e2e 依赖补上 Go 1.22+。 - 协议更新记录:待合入写本 PR;补记已合入的 #109(ui 0 width/resize)和 #108 (managedRuntimes 1 镜像地址),能力表加 managedRuntimes 1。
xiaoyumuxi
marked this pull request as ready for review
November 19, 2026 07:23
This was referenced Nov 19, 2026
xiaoyumuxi
added a commit
that referenced
this pull request
Nov 19, 2026
- 插件总览的推荐段原来写“插件围绕 JVM 工具(Maven、Gradle、Tomcat)时用 Java SDK”。 改为:管理这些工具的插件同样优先用 Rust 或 Go,后端以进程方式启动它们;只有后端必须在 JVM 里直接调用 Java 库时才用 Java SDK。中英文同步。 - 协议更新记录:已合入的 #113(官方 SDK 新增 Go)从“待合入”移到 2026-11-19 时间线。
1 task done
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
类型
feat:新增官方 Go 插件后端 SDK,外加文档更新。契约、能力版本、宿主方法、通知、清单字段和
plugin-rpc协议都不变,已有 SDK 的代码也没改。改动
Go SDK(
shared/plugins/sdk/go,新增)github.com/Lithe-IDEA/Lithe-core-rust/shared/plugins/sdk/go,包名lithe,go 1.22,只用标准库。Function、进度、取消、PluginError/pluginErrorCode)、lithe/log结构化诊断(Degraded、Recovered、SuppressSuccessDiagnostics)、插件视图View(id, handler)(整个视图、补丁、Unchanged,含width/resize),以及litheKeymapImport0(ListInputs、ReadChunk)。watch订阅和上下文变化通知)、文档与编辑器(含editor/registerActions)、预览、浏览器、窗口消息、functions/providers与functions/invoke(被调方能读到caller)、原生终端(create/show/close/reopen/dispose/onExit)、订阅。其余方法用通用的Host.Request调用,它只接受lithe/host/前缀的方法。litheBuild)和 VCS 提供者(litheVcs)。这两类后端照旧用 Node.js/Java SDK 和 Node.js SDK。fmt.Println进不了协议流。Windows 上插件代码不能写 stdout。OnInitialize、OnShutdown里的 panic 只结束当次调用,并且只发固定的panic类别。插件自己起的 goroutine 不在这个边界里。parentOperationID不传时取正在处理的调用的operationID。Subscription被Dispose()或会话结束后不再投递事件,排队中的也不投递。lithe/*_test.go用有界的内存宿主驱动会话,覆盖帧格式、会话、宿主服务、视图、快捷键导入和错误映射。宿主服务的测试读取契约 fixture。examples/sample-backend(main.go、plugin.json、ui/)和 Rust 示例跑同一个插件后端场景,包括terminal.cycle。CGO_ENABLED=0)、插件视图、快捷键导入、获取方式、日志、API 表、宿主服务、结果与错误、规则、原生终端和测试命令。端到端测试
shared/plugins/sdk/e2e/plugin_sdk_go.rs,并在rust/crates/core/Cargo.toml注册[[test]] plugin_sdk_go。the_go_sdk_sample_backend_serves_functions_and_host_servicesthe_go_sdk_import_provider_reads_a_selected_source_through_coresdk-e2e.mjs先用go build构建 Go 示例,再把它加进测试列表。设置LITHE_PLUGIN_SDK_GO_SAMPLE可以直接用已构建好的示例。.gitignore忽略shared/plugins/sdk/go/bin/。文档
shared/plugins/README.md,中英文):go get写法。sdk/go一段。litheKeymapImport0 的 SDK 列表加上 Go。terminal.cycle的说明加上 Go。plugin-backend-workspace、native-build-workflows、debug-adapter-plugin、lsp-plugin-lifecyclecapabilities-and-versions、api-catalogdomains/backend、keymap-import、ui、vcs、toolchainscapabilities-and-versions顺手修正一处:main上支持litheBuild1 的只有 Node.js 和 Java SDK,原文写的是“SDK 源码”。ui0 的width/resize)和 feat(plugins): add managedRuntimes 1 mirror URLs for runtime artifacts #108(managedRuntimes1 的镜像地址)。managedRuntimes1(2026-11-19,feat(plugins): add managedRuntimes 1 mirror URLs for runtime artifacts #108)。发布
shared/plugins/sdk/go/v<版本>发布,经 Go module proxy 和 checksum database 分发。没有版本文件,也没有发布工作流,推送标签就是发布。shared/plugins/sdk/go/v0.1.0。本 PR 不推送标签,合入后由维护者决定什么时候发布。CI
plugins-verify.yml的路径过滤shared/plugins/**已经覆盖 Go SDK。sdk-e2ejob 在ubuntu-latest上用 runner 预装的 Go 构建示例,没有加setup-go。sdk-rust一样的 job,需要维护者同意后再加,本 PR 没有改工作流。验证(macOS arm64,Go 1.27.4,Java 17,Maven)
go -C shared/plugins/sdk/go test -race -count=1 ./...:通过(之前还跑过-count=3)。go -C shared/plugins/sdk/go vet ./...和gofmt -l shared/plugins/sdk/go:没有问题。node shared/plugins/scripts/verify-docs.mjs:通过。node --test shared/plugins/scripts/*.test.mjs:2 个全过。node shared/plugins/scripts/sdk-e2e.mjs:五个 e2e 测试文件、11 个用例全过,其中plugin_sdk_go2/2。本机 Java 是 17,CI 用 Java 8。go vet,全部通过。