Repository navigation
feat(backend): 语言服务器由后端启动,运行/调试/测试经宿主通用 API 接管 - #6
Merged
Merged
Conversation
- `java.resolveLaunch`:语言服务器改为 `launch.kind: "backend"`,后端按包内布局解析 JDT LS、Lombok、java-debug、测试运行器与 JDK,去掉 `hostIntegration: jdt` - `backend/src/run.rs`:用 `editor/registerActions` 提供 `.java` 文件的行内 Run/Debug 动作;点击经 JDT LS 构建并解析类路径(main)或规划测试启动(JUnit/TestNG),再用 `run/start` 以清单 `requiresTools: ["java"]` 引用的 JDK 工具定义启动;调试时附 jdwp 代理并由宿主接到 `java` 调试适配器 - 测试结果:后端在回环端口监听 Eclipse JUnit 运行器,结束后用窗口消息显示计数,`run/didExit` 后停止 - `outputLinkMatchers`:堆栈行 `at pkg.Class.method(Class.java:12)` 经 `java.resolveOutputLink` 用 `workspace/findFiles` 解析为工作区文件 - 清单:`serverProcess: 4` + `requiresTools`、`debugAdapters: 3`(热替换 `redefineClasses` 与默认步进过滤 `$JDK`/`$Libraries`)、`outputLinkMatchers: 1`、新增权限与 `vscode.java.*` 命令白名单 - 文档:MIGRATION.md 第 5.8/5.9 节、第 6/10 节与 README 同步
…的日志级别 - `java.resolveLaunch` 读取请求的 `tools.java`,写进 `java.configuration.runtimes` 作为默认 JDK, 运行时编译目标与 Run 使用的 JDK 一致,不再出现 UnsupportedClassVersionError - 启动前在工作区文件夹里有界扫描 `.java` 文件写入 `triggerFiles`,无构建文件的工程也能被 JDT LS 正确布局; 宿主没答 `workspace/getFolders` 时记 `launch.workspace_folders_unavailable` 降级诊断 - 去掉 `-Declipse.log.level=WARNING`:JDT LS 1.61 在客户端连接时读首条平台日志的日期,过滤掉 INFO 会让它 在回答 initialize 前因 NullPointerException 退出 - 后端收到 `language/status` ServiceReady 后重新注册编辑器动作绑定,打开的文档立刻显示运行标记 - MIGRATION.md 补充上述行为与宿主工具栏 Run/Debug 对编辑器动作的映射
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.
做了什么
Java 拆分(主仓库 1lck/Lithe-IDEA#1495)的插件侧:宿主不再内置任何 Java/JDT 知识,本插件的后端接手语言服务器启动、运行、调试和测试,全部走宿主通用插件 API。配套的宿主改动见 1lck/Lithe-IDEA#1791(Draft)。
语言服务器由后端启动(
serverProcess: 4)plugin.json的语言服务器launch改为{kind: "backend", function: "java.resolveLaunch", timeoutMilliseconds: 60000},去掉hostIntegration: jdt与宿主侧 JDT 资源映射。backend/src/launch.rs:按包内布局解析 JDT LS、Lombok agent、java-debug、java-test 扩展与运行器、打包 JDK,产出完整命令行;宿主只负责起进程。java.resolveLaunch读取请求里的tools.java(宿主按清单requiresTools: ["java"]解析到的 JDK),写进java.configuration.runtimes作为默认 JDK,编译目标与 Run 使用的 JDK 一致,修掉拆分过程中出现的UnsupportedClassVersionError。.java写入triggerFiles,没有构建文件的工程也能被 JDT LS 正确布局;宿主没答workspace/getFolders时记launch.workspace_folders_unavailable降级诊断。-Declipse.log.level=WARNING:JDT LS 1.61 在客户端连接时读首条平台日志的日期,过滤 INFO 会让它在initialize前因 NPE 退出。运行 / 调试 / 测试由后端经通用 API 接管
backend/src/run.rs:用editor/registerActions为.java文件提供行内 Run/Debug 动作(main 方法、JUnit/TestNG 测试类与方法);收到language/statusServiceReady 后重新注册,打开的文档立刻显示运行标记。vscode.java.buildWorkspace/resolveClasspath/resolveMainMethod等命令构建并解析类路径,或规划测试启动,再用lithe/host/run/start以java工具定义启动;调试时附 jdwp 代理,宿主接到java调试适配器(lithe/host/debug/start)。run/didExit后停止。outputLinkMatchers: 1:堆栈行at pkg.Class.method(Class.java:12)经java.resolveOutputLink用workspace/findFiles解析成工作区文件链接。debugAdapters: 3:声明热替换(redefineClasses/hotcodereplace)与默认步进过滤$JDK、$Libraries,宿主不再内置 Java 的步进策略。清单其他改动
documents.contentProvider、documents.read、editor.actions等;requestMethods加java/classFileContents;commands白名单加vscode.java.*;forwardNotifications转发language/eventNotification|progressReport|status;语言服务器state改为 workspace 作用域并限制保留数量;remote: "unsupported"。assemble-package.sh/verify-package.sh:不再由宿主提供运行时参数,校验后端可执行与包内 JDT 资源布局。文档
合入顺序
依赖宿主侧拆分 PR 中的
serverProcess隐式工具引用、debugAdapters: 3、outputLinkMatchers与编辑器动作映射;宿主先合,本 PR 随后发预发布版本验证。已知限制(后续)
toolchains.list([Feature] API-23 开放通用 toolchains.list / toolchains.resolve 宿主方法 1lck/Lithe-IDEA#1786)。验证
cargo fmt --check:通过。cargo clippy --workspace --all-targets -- -D warnings:通过。cargo test --workspace:369 个测试通过(领域 282、后端单元 77、repository_pins7、session3)。