Repository navigation
feat: 缺少 gopls、dlv 时可以在插件详情里安装(commandInstallers) - #8
Merged
Merged
Conversation
清单声明 commandInstallers(API-23):gopls 和 dlv 用注入的 go 工具运行 go install <包>@latest 安装,可以装进 Lithe 管理的目录(设置 GOBIN),也可以 装进 Go 的默认位置(go env GOBIN,为空时 GOPATH 第一项加 bin)。 requires 加 commandInstallers 0,requiresTools 为 go,权限加 commands.install。 README 改写依赖的程序一节,功能矩阵更新 gopls、dlv 缺失时的验证步骤, 宿主端到端测试的固定提交升到 1lck/Lithe-IDEA#1971 的 a9bddd922。
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.
背景
试装 Go 插件时,电脑上没有
gopls或dlv的话,插件详情里只显示英文原始错误(“plugin package path is not usable: none of the plan's commands is available”),不知道缺什么、怎么装。Lithe-IDEA/Lithe-core-rust#53(main c550c2b)加入了通用的
commandInstallers契约(API-23):插件声明“用哪个已注入的工具、什么参数安装哪些命令”,Core 校验并展开。1lck/Lithe-IDEA#1971(Draft)让宿主在能力卡片上显示“未找到 xxx”和安装按钮,用户选安装位置、看清要运行的命令后确认。宿主和 Core 里没有任何 Go 专属代码,本 PR 只在插件清单里声明 gopls 和 dlv 怎么装。改动
plugin.json(版本仍是 0.1.0:0.1.0 还没发布,这些内容并进 0.1.0)requires加入commandInstallers: 0。新增
requiresTools: ["go"]:安装器用的go工具来自插件自己的toolDefinitions[go]。permissions加入commands.install:安装对话框里显示为“安装插件所需的命令行工具(每次安装前都会征得你的同意)”。新增
commandInstallers,两项结构相同:goplsgoplsinstall golang.org/x/tools/gopls@latestdlvdlvinstall github.com/go-delve/delve/cmd/dlv@latesttool: go,minimumVersion: 1.21(Go 1.21 起有GOTOOLCHAIN,go install能取命令模块要求的更新 Go),mayUseNetwork: true,超时用默认的 10 分钟。targets.managed:环境变量GOBIN=${installDirectory},装进 Lithe 管理的目录(插件状态目录下,卸载插件时删除),不动 Go 的默认目录。targets.toolDefault:不设GOBIN;用go env GOBIN找目录,为空时用go env GOPATH的第一项加bin。卸载插件时不删这些文件。README.mdPATH;新增在插件详情里安装的步骤和两种安装位置的说明;权限列表加上安装命令行工具;保留在终端用go install手动安装的写法。docs/releases/v0.1.0.md:功能里加上安装 gopls 和 dlv;权限加commands.install;依赖的程序改写;兼容性改为需要 Core c550c2b 或更新版本的桌面端,并说明更早的桌面端为什么会拒绝安装。docs/feature-matrix.mdgo-support-plugin:能力、证据、依赖的宿主能力加上commandInstallers;验证方法第 4 步写明 gopls 也可能来自安装目录,第 7 步改为语言服务器卡片显示“未找到 gopls”和安装按钮、两种位置各装一次后的检查;最近验证注明安装没有被覆盖。go-debug-delve:能力、证据、依赖的宿主能力同样更新;验证方法第 6 步改为调试器卡片显示“未找到 dlv”和安装按钮、安装后能停在断点。e2e/host/lithe-host.json:宿主固定到a9bddd922(feat(desktop): 插件缺少的命令可在能力卡片上一键安装(API-23 commandInstallers) 1lck/Lithe-IDEA#1971 的分支头提交:preview 4caa57a33 加上 Core c550c2b 和命令安装)。原来的b03dbf0c0不认识commandInstallers,装这个清单会被拒绝。验证
pluginhost.Validate+Declared(),再调plugins.commandInstallers.requirements、plan(managed、toolDefault)、defaultDirectoryrequirements列出语言服务器go→gopls、调试适配器delve→dlv;managed展开为go install …@latest加GOBIN=<目录>;toolDefault没有额外环境,两个探测命令;GOBIN为空、GOPATH=/Users/x/go时默认目录是/Users/x/go/binnode scripts/package.mjsLithe-store/scripts/validate-index.mjs的checkManifest:只检查schemaVersion、pluginAPIVersion、requires格式、版本一致和signatureRequirement,没有权限白名单,新字段不影响;CI 会实际跑一遍e2e/host/desktop/**拷进 #1971 的检出跑go vet ./internal/workbench/ ./internal/projectgen/,跑完删掉node scripts/e2e-host.mjs(宿主端到端测试)合入前
e2e/host/lithe-host.json改成它在 preview 上的合入提交。