diff --git a/.agents/notes/implemented/bug-fix/2026-11-13-close-tab-test-binding-invalidation.md b/.agents/notes/implemented/bug-fix/2026-11-13-close-tab-test-binding-invalidation.md
new file mode 100644
index 0000000000..97bdd1dfbe
--- /dev/null
+++ b/.agents/notes/implemented/bug-fix/2026-11-13-close-tab-test-binding-invalidation.md
@@ -0,0 +1,41 @@
+# Agent 笔记:关闭标签测试的快捷键变更必须请求刷新
+
+状态:已实现
+
+## 先说结论
+
+无头测试直接修改快捷键时,也要像真实设置页一样通知界面刷新。否则输入仍使用上一帧的绑定,后台任务偶然产生的刷新会掩盖问题。关闭标签测试现在明确请求刷新,并在所有平台验证用户新增的绑定,避免 macOS 默认键位掩盖测试缺口。
+
+## 问题
+
+[#1885](https://github.com/1lck/Lithe-IDEA/issues/1885) 来自 Linux CI:添加 Control-W 后日志页签仍然打开。`6268d92923` 引入的测试只改内存设置,没有真实设置页 `SetKeymap` 的刷新通知;测试驱动的 `Pump` 只在已有唤醒标记时绘制,不保证每次调用都重画。
+
+macOS 原测试直接使用初始注册的 Command-W,因此无法覆盖同一缺陷。在 macOS 显式新增 Control-W 的独立探针及正式回归都复现相同失败,排除了 Java 插件的影响。
+
+## 决策
+
+测试的绑定辅助函数在更新后调用现有刷新接口,下一次输入前由驱动处理刷新;不修改产品逻辑或框架行为。新增跨平台用户绑定回归,先消费已有帧,再修改绑定并立即触发,防止无关后台唤醒提供偶然的刷新。
+
+正确做法是“更新测试设置、明确请求刷新、发送按键”。不要只更新字段后靠下一次后台活动、延长等待或重复运行获取绿灯。
+
+## 考虑过的备选方案
+
+- 每次 Pump 都强制绘制:改变成熟框架的按需绘制语义,掩盖测试与真实设置路径的差异。
+- 加 sleep 或重试按键:依赖后台时序,还可能重复关闭其他标签。
+- 只跑 macOS 默认键位:遗漏用户自定义绑定及其他平台。
+
+## 后果
+
+测试不再依赖偶然刷新;新增少量测试辅助代码和一项跨平台回归。产品运行时、默认快捷键、资源、性能与插件契约均不改变。
+
+## 验证
+
+- `scripts/desktop/desktop-go.sh test ./internal/workbench -run '^TestCloseTabUserBindingClosesTheSelectedEditorTab$' -count=1`:未请求刷新时失败,日志页签仍为 1;修复后通过。
+- `scripts/desktop/desktop-go.sh test ./internal/workbench -run '^TestCloseTab' -count=1` 与相同范围的 `-race`。
+- `./scripts/agent-notes/verify-agent-notes.sh` 与测试稳定性静态检查。
+- Linux、Windows 的目标平台结果以配套 PR 的 CI 为准,本地 macOS 回归不能代替它们。
+
+## 适用范围
+
+- `desktop/internal/workbench/close_tab_shortcut_test.go`
+- `desktop/internal/workbench/settings.go` 的真实设置变更刷新顺序。
diff --git a/.agents/notes/implemented/bug-fix/2026-11-13-viva-plugin-run-debug-lifecycle.md b/.agents/notes/implemented/bug-fix/2026-11-13-viva-plugin-run-debug-lifecycle.md
index 868bed3cf2..dcabfb45df 100644
--- a/.agents/notes/implemented/bug-fix/2026-11-13-viva-plugin-run-debug-lifecycle.md
+++ b/.agents/notes/implemented/bug-fix/2026-11-13-viva-plugin-run-debug-lifecycle.md
@@ -24,9 +24,28 @@ Run 的首次调试复用既有适配器加载入口,完成后检查原调用
真实插件测试在创建工作台后就登记无交互清理,不依赖成功路径的关闭动作。即使断言在断点暂停或文档未保存时中止,也直接关闭测试拥有的项目,等待后台任务、停止剩余运行,并验证 Core 调试会话已移除;不能把需要用户确认的关闭弹窗当作失败清理。
+## 项目 JDK 与语言服务器的编译目标
+
+普通源码目录没有 Maven 的目标版本约束时,Viva 曾只把项目选择的 JDK 交给 Run,没有在后端解析语言服务器启动时传入契约已有的可选 `tools`。JDT 因而按随包 Java 21 编译,Run 却使用用户选择的 Java 8,生成的 major 65 class 会被 Java 8 拒绝。只检查 Maven 构建的 class 无法发现这个问题,必须也检查 JDT 的运行前构建。
+
+宿主现在复用 Build/Run 的工具选择,将清单声明工具的 executable、home、version 作为原生安装事实交给后端。可选安装不存在时不覆盖服务器已有配置;读取失败继续返回失败,项目脚本不作为安装事实,环境与凭据不跨这个边界。Java 插件根据这些事实配置 JDT,宿主不解释 Java 版本或 POM。
+
+例如选择 Java 8 的普通源码项目,应在 JDT 编译后仍生成 major 52,并实际用 Java 8 运行、暂停和停止;不能仅让 Maven 的 source/target 掩盖默认 JDK 接线缺失。回归同时覆盖普通目录、外部 JAR、Ant 源码布局和 Eclipse 多源码根;Ant 布局的通过不等于支持执行 Ant target。
+
+冷启动还受到共享握手期限约束。Windows 虚拟机中的真实 JDT 握手实测约 15.4 秒,超过原 Core 默认的 10 秒。Core 的通用默认期限改为 60 秒,显式期限仍优先,取消、超时终止和进程树回收保持原行为;不按 Java 名称分支,也不增加 Core 启动重试。Core 已将声明中的 runtime 归一为工具计划,入口路径也已经展开为绝对路径。Viva 旧桥接只处理旧 runtime 的入口,导致工具计划丢掉 JAR 文件。原生适配器现在把 Core 的入口转换回包内相对路径后逐段验证,拒绝越界和符号链接;再通过 Core 已有的 toolchains.instantiateLaunch 使用定义方的模板。Java 工具的 `-jar` 和入口位置由 Java 插件声明,宿主没有 Java 分支。Gradle 集成同时核验真实设置函数与中转没有超时;不通过延长设置调用期限掩盖进程退出。注入时间的回归验证 15 秒时仍可初始化、61 秒时失败并终止,不让测试真实等待一分钟。目标平台完整工作流必须另行运行,单项 Core 回归不代表 Windows 已验收。
+
+## 冷索引期间的动作恢复
+
+JDT 的 ServiceReady 和项目导入事件并不保证索引任务已经结束。Windows 冷导入中,动作查询在索引结束前用完 6 秒期限,插件返回空动作;索引稍后结束却没有新的模型变化,动作一直为空。将测试等待从 15 秒延长至 120 秒仍失败,证明不能只延长测试等待来解决。
+
+Java 插件现在记录每个活动工作区的一份延迟查询状态,启用 JDT 公开的 `progressReportProvider` 扩展,并监听既有 `language/progressReport` complete 边界;只有发生过瞬态查询失败才在该边界重新注册动作。每个工作区最多跟踪 128 个活动任务标识,等活动任务全部完成才重查,避免零散完成事件在索引结束前耗尽预算。完成计数同时覆盖“工作完成先到、查询超时后到”的竞态。一个失败周期最多自动刷新三次,成功重置预算,工作区和服务器代际变化会隔离旧状态;关闭工作区时删除记录。不新增轮询、计时线程或项目语义模型。
+
+Core 保留标准 LSP 进度的所有权;插件不申请转发宿主保留的方法。JDT 自己选择扩展通道,进度通知会跨现有插件通道转发,但普通进度报告只做常量级检查,不会逐条触发动作查询。延迟、恢复和预算耗尽分别进入 SDK 结构化诊断;这不修改宿主 API。Windows 长 classpath 另由插件复用 manifest JAR 规划,JAR 字节交给宿主临时文件接口,运行结束由宿主删除,不写安装目录。长 module-path 仍不属于已完成范围。
+
## 考虑过的备选方案
- 放宽 Core 声明解码:掩盖宿主把路由信息当成声明的错误,也允许其他无效字段通过。
+- 固定增大等待或对所有进度报告重查:前者已在真实冷导入中证明不能恢复丢失的动作,后者会在正常索引时反复触发昂贵查询。只在失败后的工作完成边界重查。
- 要求用户编辑文件或先打开 Debug 面板:把接线时序变成操作前提,不能修复首次使用。
- 在 Java 插件里按 PID 杀进程:插件不拥有宿主进程树,会重复实现原生清理并误伤外部附加目标。
@@ -50,5 +69,6 @@ Run 的首次调试复用既有适配器加载入口,完成后检查原调用
- `desktop/internal/pluginservice/hostactions.go`、`hostproviders.go`、`runs.go`
- `desktop/internal/workbench/debug_start.go`、`debug.go`、`pluginworkbench.go`、`pluginbackends.go`
-- `desktop/internal/workbench/java_plugin_e2e_test.go`、`java_legacy_e2e_test.go`
+- `desktop/internal/workbench/java_plugin_e2e_test.go`、`java_legacy_e2e_test.go`、`java_unmanaged_e2e_test.go`
+- `desktop/internal/pluginservice/backendlaunch.go`、`backendlaunch_test.go`;Core 的语言服务器引擎握手期限
- 通用职责边界见 [插件后端会话与宿主服务](../architecture/2026-11-10-viva-plugin-host-services-and-backend-sessions.md)。
diff --git a/desktop/internal/core/plugin_session_test.go b/desktop/internal/core/plugin_session_test.go
index db5bbc662c..fbcd683f45 100644
--- a/desktop/internal/core/plugin_session_test.go
+++ b/desktop/internal/core/plugin_session_test.go
@@ -437,3 +437,18 @@ func TestPluginLaunchArchitectureAcceptsOnlyTheContractSpelling(t *testing.T) {
}
}
}
+
+func TestRuntimeToolPlanKeepsAnEntryForNativeInstantiation(t *testing.T) {
+ manifest, err := os.ReadFile(contractfixture.Path("fixtures/run/tool-reference-launch.plugin.json"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ root := t.TempDir()
+ plan, err := NewClient().PlanPluginLanguageServer(testContext(t), manifest, "script", PluginBackendDirectories{PluginDirectory: root, StateDirectory: t.TempDir(), Architecture: PluginArchitecture()})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if plan.Launch.Kind != "tool" || plan.Launch.Entry == "" {
+ t.Fatalf("runtime lost its entry: %+v", plan.Launch)
+ }
+}
diff --git a/desktop/internal/pluginbackend/pluginbackend.go b/desktop/internal/pluginbackend/pluginbackend.go
index be6bbd3600..50fa5a01c7 100644
--- a/desktop/internal/pluginbackend/pluginbackend.go
+++ b/desktop/internal/pluginbackend/pluginbackend.go
@@ -156,7 +156,8 @@ type Runner struct {
lookup func(name string) (string, error)
// tools resolves a plan's {kind: "tool"} launch to an executable. Nil refuses
// such a launch rather than guessing a program.
- tools ToolResolver
+ tools ToolResolver
+ toolEntries ToolEntryResolver
// initializeTimeout is the startup-handshake deadline applied to a request
// that does not carry its own. Zero keeps Core's default.
initializeTimeout time.Duration
@@ -174,8 +175,23 @@ func (r *Runner) SetInitializeTimeout(timeout time.Duration) { r.initializeTimeo
type ToolExecutable struct {
Path string
Environment map[string]string
+ // Arguments are the complete vector Core instantiated for a package entry.
+ Arguments []string
}
+// ToolEntryLaunch contains verified native paths and the opaque inputs to
+// Core's tool template. No host code interprets a tool's entry grammar.
+type ToolEntryLaunch struct {
+ Tool, Executable, Entry, MinimumVersion string
+ RuntimeArguments, Arguments []string
+}
+
+// ToolEntryResolver applies a Core-owned tool template to verified native facts.
+type ToolEntryResolver func(context.Context, string, string, ToolEntryLaunch) (ToolExecutable, error)
+
+// SetToolEntryResolver installs the entry planner before any backend starts.
+func (r *Runner) SetToolEntryResolver(resolver ToolEntryResolver) { r.toolEntries = resolver }
+
// ToolResolver resolves the tool definition a plugin launch names to the
// executable the host runs, using the host's toolchain layers for the workspace
// the process serves (workingDirectory, empty for a process with no workspace).
@@ -278,9 +294,24 @@ func (r *Runner) Start(ctx context.Context, request StartRequest) (Session, erro
return Session{}, err
}
}
- // A tool launch runs the installation the toolchain layers select; the plan's
- // own environment wins over what the selection declares.
+ arguments := Arguments(plan, resolved.Entry)
+ // A tool entry is instantiated by Core using its declaring plugin's
+ // template after native path verification. This also covers packaged tools.
var toolEnvironment map[string]string
+ if plan.Launch.Kind == pluginhost.LaunchTool && resolved.Entry != "" {
+ if r.toolEntries == nil {
+ return Session{}, fmt.Errorf("%w: this host cannot instantiate tool entries", ErrRequest)
+ }
+ tool, err := r.toolEntries(ctx, request.PluginID, request.WorkingDirectory, ToolEntryLaunch{
+ Tool: plan.Launch.Tool, Executable: executable, Entry: resolved.Entry,
+ MinimumVersion: plan.Launch.MinimumVersion, RuntimeArguments: plan.Launch.RuntimeArguments, Arguments: plan.Arguments,
+ })
+ if err != nil {
+ return Session{}, err
+ }
+ executable, toolEnvironment, arguments = tool.Path, tool.Environment, tool.Arguments
+ }
+ // A bare tool launch uses the selected installation and the opaque args.
if executable == "" && plan.Launch.Kind == pluginhost.LaunchTool {
if r.tools == nil {
return Session{}, fmt.Errorf("%w: this host cannot resolve tool launches", ErrRequest)
@@ -303,7 +334,7 @@ func (r *Runner) Start(ctx context.Context, request StartRequest) (Session, erro
PluginID: request.PluginID,
Role: role,
ExecutablePath: executable,
- Arguments: Arguments(plan, resolved.Entry),
+ Arguments: arguments,
Environment: mergeEnvironment(mergeEnvironment(toolEnvironment, plan.Environment), request.Environment),
SessionPolicy: plan.SessionPolicy,
RootURI: request.RootURI,
diff --git a/desktop/internal/pluginbackend/pluginbackend_test.go b/desktop/internal/pluginbackend/pluginbackend_test.go
index 8e764fafde..d7e47838f3 100644
--- a/desktop/internal/pluginbackend/pluginbackend_test.go
+++ b/desktop/internal/pluginbackend/pluginbackend_test.go
@@ -10,9 +10,12 @@ import (
"sort"
"sync"
"testing"
+ "time"
+ "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture"
"github.com/1lck/Lithe-IDEA/desktop/internal/core"
"github.com/1lck/Lithe-IDEA/desktop/internal/pluginhost"
+ "github.com/1lck/Lithe-IDEA/desktop/internal/toolchain"
)
// fakeKernel records what the runner asked Core to do.
@@ -635,3 +638,50 @@ func TestStartResolvesAToolThroughTheHostToolchain(t *testing.T) {
t.Fatalf("environment = %v", env)
}
}
+
+func TestToolEntryUsesCoreInstantiationAfterNativeVerification(t *testing.T) {
+ root := backendPackage(t)
+ entry := filepath.Join(root, "入口 with 空格.script")
+ if err := os.WriteFile(entry, []byte("fixture"), 0600); err != nil {
+ t.Fatal(err)
+ }
+ executable, err := os.Executable()
+ if err != nil {
+ t.Fatal(err)
+ }
+ plan := core.PluginBackendPlan{}
+ plan.Launch.Kind, plan.Launch.Tool = pluginhost.LaunchTool, "interpreter"
+ plan.Launch.Entry = entry
+ plan.Launch.RuntimeArguments = []string{"--runtime-option"}
+ plan.Arguments = []string{"--stdio"}
+ kernel := &fakeKernel{plan: plan, started: core.PluginBackendStarted{SessionID: "entry-session"}}
+ runner := New(kernel, echoServices(t))
+ if _, err := runner.Start(context.Background(), startRequest(root)); !errors.Is(err, ErrRequest) {
+ t.Fatalf("missing template resolver: %v", err)
+ }
+ manifest, err := os.ReadFile(contractfixture.Path("fixtures/run/tool-reference-launch.plugin.json"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ registry, err := toolchain.RegistryInput([]json.RawMessage{manifest})
+ if err != nil {
+ t.Fatal(err)
+ }
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ defer cancel()
+ runner.SetToolEntryResolver(func(_ context.Context, _, _ string, input ToolEntryLaunch) (ToolExecutable, error) {
+ if input.Entry != entry || input.Tool != "interpreter" || len(input.RuntimeArguments) != 1 || input.RuntimeArguments[0] != "--runtime-option" || len(input.Arguments) != 1 || input.Arguments[0] != "--stdio" {
+ t.Fatalf("wrong verified facts for Core: %+v", input)
+ }
+ // Use the linked Core and its shared non-Java contract fixture. Native
+ // adapters only supply facts; Core owns the tool's argument grammar.
+ launch, err := core.NewClient().InstantiateToolchainLaunch(ctx, registry, input.Tool, executable, "", input.Entry, input.RuntimeArguments, input.Arguments)
+ return ToolExecutable{Path: launch.Executable, Arguments: launch.Arguments}, err
+ })
+ if _, err := runner.Start(context.Background(), startRequest(root)); err != nil {
+ t.Fatal(err)
+ }
+ if got := kernel.started_.Arguments; len(got) != 3 || got[0] != "--runtime-option" || got[1] != plan.Launch.Entry {
+ t.Fatalf("Core arguments lost: %v", got)
+ }
+}
diff --git a/desktop/internal/pluginhost/launch.go b/desktop/internal/pluginhost/launch.go
index d4125e0569..b9f158fb95 100644
--- a/desktop/internal/pluginhost/launch.go
+++ b/desktop/internal/pluginhost/launch.go
@@ -2,6 +2,7 @@ package pluginhost
import (
"fmt"
+ "path/filepath"
"strings"
)
@@ -115,15 +116,21 @@ func VerifyLaunch(packageDirectory string, launch Launch) (Resolved, error) {
}
return Resolved{Required: required}, nil
case LaunchTool:
- // The tool is resolved by the host's toolchain registry, not from the package.
+ // Current Core plans represent runtime entries as tools. Apply the same
+ // native path verification as a legacy runtime before Core instantiates
+ // the tool's entry template; a bare tool has no entry to verify.
if launch.Tool == "" {
return Resolved{}, fmt.Errorf("%w: a tool launch names no tool", ErrPackagePath)
}
- required, err := ResolvePackagePaths(packageDirectory, launch.Required)
+ entry, err := plannedPackagePath(packageDirectory, launch.Entry)
if err != nil {
return Resolved{}, err
}
- return Resolved{Required: required}, nil
+ runtime, err := plannedPackagePath(packageDirectory, launch.PackagedRuntime)
+ if err != nil {
+ return Resolved{}, err
+ }
+ return VerifyLaunch(packageDirectory, Launch{Kind: LaunchRuntime, Tool: launch.Tool, Entry: entry, PackagedRuntime: runtime, Required: launch.Required})
default:
return Resolved{}, fmt.Errorf("%w: unknown launch kind %q", ErrPackagePath, launch.Kind)
}
@@ -179,3 +186,17 @@ func GrantServices(requested []string, services *Services) []string {
}
return granted
}
+
+// Core expands tool entry paths to absolute native paths. Relativizing them
+// preserves ResolvePackagePath's segment-by-segment no-symlink verification;
+// traversal, other volumes and files outside the package remain refusals.
+func plannedPackagePath(root, path string) (string, error) {
+ if !filepath.IsAbs(path) {
+ return path, nil
+ }
+ relative, err := filepath.Rel(root, path)
+ if err != nil {
+ return "", fmt.Errorf("%w: %w", ErrPackagePath, err)
+ }
+ return filepath.ToSlash(relative), nil
+}
diff --git a/desktop/internal/pluginhost/launch_test.go b/desktop/internal/pluginhost/launch_test.go
index b1dc495803..4b9097587d 100644
--- a/desktop/internal/pluginhost/launch_test.go
+++ b/desktop/internal/pluginhost/launch_test.go
@@ -223,3 +223,14 @@ func TestVerifyLaunchAcceptsHostRuntimeWithPackagedEntry(t *testing.T) {
t.Fatalf("resolved = %+v", resolved)
}
}
+
+func TestToolEntryIsVerifiedInsideThePackage(t *testing.T) {
+ root := launchPackage(t)
+ resolved, err := VerifyLaunch(root, Launch{Kind: LaunchTool, Tool: "interpreter", Entry: filepath.Join(root, "lib/main.js")})
+ if err != nil || resolved.Entry != filepath.Join(root, "lib/main.js") {
+ t.Fatalf("tool entry was not verified: %+v %v", resolved, err)
+ }
+ if _, err := VerifyLaunch(root, Launch{Kind: LaunchTool, Tool: "interpreter", Entry: "../outside.js"}); err == nil {
+ t.Fatal("tool entry escaped the installed package")
+ }
+}
diff --git a/desktop/internal/pluginservice/backendlaunch.go b/desktop/internal/pluginservice/backendlaunch.go
index 92f497cc07..49fbad6174 100644
--- a/desktop/internal/pluginservice/backendlaunch.go
+++ b/desktop/internal/pluginservice/backendlaunch.go
@@ -72,7 +72,10 @@ func (s *Service) resolveBackendLaunch(ctx context.Context, pluginID, version st
}
// The function's params are the plan's resolveParams themselves, as the
// contract says: serverID, platform, the four directories and the settings.
- params := plan.ResolveParams
+ params, err := s.languageLaunchParams(ctx, workspace.Path, manifest, plan.ResolveParams)
+ if err != nil {
+ return fail(err)
+ }
reference, err := json.Marshal(workspace.ContextRef)
if err != nil {
return fail(err)
@@ -99,3 +102,46 @@ func (s *Service) resolveBackendLaunch(ctx context.Context, pluginID, version st
}
return backendLaunch{plan: &decoded, directories: directories}, nil
}
+
+// languageLaunchParams supplies native installation facts, without interpreting
+// any tool's version or configuration. Core already validated requiresTools;
+// the resolver uses the same user choices and discovery as Build and Run.
+func (s *Service) languageLaunchParams(ctx context.Context, root string, manifest, params json.RawMessage) (json.RawMessage, error) {
+ if s.LanguageTool == nil {
+ return params, nil
+ }
+ var declaration struct {
+ RequiresTools []string `json:"requiresTools"`
+ }
+ if err := json.Unmarshal(manifest, &declaration); err != nil {
+ return nil, err
+ }
+ type installation struct {
+ Executable string `json:"executable"`
+ Home *string `json:"home,omitempty"`
+ Version string `json:"version,omitempty"`
+ }
+ tools := make(map[string]installation)
+ for _, tool := range declaration.RequiresTools {
+ selected, err := s.LanguageTool(ctx, root, tool)
+ if err != nil {
+ return nil, err
+ }
+ if selected != nil && !selected.ProjectCode {
+ tools[tool] = installation{selected.Executable, selected.Home, selected.Version}
+ }
+ }
+ if len(tools) == 0 {
+ return params, nil
+ }
+ var value map[string]json.RawMessage
+ if err := json.Unmarshal(params, &value); err != nil {
+ return nil, err
+ }
+ encoded, err := json.Marshal(tools)
+ if err != nil {
+ return nil, err
+ }
+ value["tools"] = encoded
+ return json.Marshal(value)
+}
diff --git a/desktop/internal/pluginservice/backendlaunch_test.go b/desktop/internal/pluginservice/backendlaunch_test.go
new file mode 100644
index 0000000000..f6ed64d3dc
--- /dev/null
+++ b/desktop/internal/pluginservice/backendlaunch_test.go
@@ -0,0 +1,57 @@
+package pluginservice
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "testing"
+
+ "github.com/1lck/Lithe-IDEA/desktop/internal/core"
+)
+
+func TestLanguageLaunchReceivesSelectedInstallations(t *testing.T) {
+ home := "/selected/sdk"
+ service := &Service{LanguageTool: func(_ context.Context, root, tool string) (*core.ToolchainSelection, error) {
+ if root != "/workspace" {
+ t.Fatalf("wrong workspace: %s", root)
+ }
+ switch tool {
+ case "compiler":
+ return &core.ToolchainSelection{Executable: home + "/bin/compiler", Home: &home, Version: "8", Environment: map[string]string{"SECRET": "not forwarded"}}, nil
+ case "project-script":
+ return &core.ToolchainSelection{Executable: "/workspace/wrapper", ProjectCode: true}, nil
+ default:
+ return nil, nil
+ }
+ }}
+ result, err := service.languageLaunchParams(context.Background(), "/workspace",
+ json.RawMessage(`{"requiresTools":["compiler","missing","project-script"]}`), json.RawMessage(`{"serverID":"example","settings":{}}`))
+ if err != nil {
+ t.Fatal(err)
+ }
+ var value map[string]json.RawMessage
+ if err := json.Unmarshal(result, &value); err != nil {
+ t.Fatal(err)
+ }
+ if string(value["serverID"]) != `"example"` || string(value["tools"]) != `{"compiler":{"executable":"/selected/sdk/bin/compiler","home":"/selected/sdk","version":"8"}}` {
+ t.Fatalf("launch facts: %s", result)
+ }
+}
+
+func TestLanguageLaunchPropagatesToolReadFailure(t *testing.T) {
+ want := errors.New("permission denied")
+ service := &Service{LanguageTool: func(context.Context, string, string) (*core.ToolchainSelection, error) { return nil, want }}
+ _, err := service.languageLaunchParams(context.Background(), "/workspace", json.RawMessage(`{"requiresTools":["compiler"]}`), json.RawMessage(`{}`))
+ if !errors.Is(err, want) {
+ t.Fatalf("lost read failure: %v", err)
+ }
+}
+
+func TestLanguageLaunchKeepsParamsWithoutOptionalTools(t *testing.T) {
+ service := &Service{LanguageTool: func(context.Context, string, string) (*core.ToolchainSelection, error) { return nil, nil }}
+ params := json.RawMessage(`{"settings": {"user": true}}`)
+ result, err := service.languageLaunchParams(context.Background(), "/workspace", json.RawMessage(`{"requiresTools":["missing"]}`), params)
+ if err != nil || string(result) != string(params) {
+ t.Fatalf("changed unconfigured launch: %s %v", result, err)
+ }
+}
diff --git a/desktop/internal/pluginservice/pluginservice.go b/desktop/internal/pluginservice/pluginservice.go
index e0e974d97e..5f8bca0bc5 100644
--- a/desktop/internal/pluginservice/pluginservice.go
+++ b/desktop/internal/pluginservice/pluginservice.go
@@ -102,6 +102,9 @@ type Service struct {
resources *hostResources
// Runs owns the processes backends start through run/start.
Runs *Runs
+ // LanguageTool resolves an optional installation for a backend-resolved
+ // language server. A nil installation means the tool is unavailable.
+ LanguageTool func(context.Context, string, string) (*core.ToolchainSelection, error)
// kernel reads what only Core can validate, such as a plugin's grammar.
kernel Kernel
// lsMu guards the running plugin-owned language servers backends reach.
diff --git a/desktop/internal/toolchain/load.go b/desktop/internal/toolchain/load.go
index 7f30e5e5dc..caf402144b 100644
--- a/desktop/internal/toolchain/load.go
+++ b/desktop/internal/toolchain/load.go
@@ -26,9 +26,9 @@ func (e *UnavailableError) Error() string {
return fmt.Sprintf("toolchain %s is unavailable: %s", e.Tool, e.Code)
}
-// rawRegistry is the request shape every registry input expects. Core treats it
+// RegistryInput is the request shape every registry input expects. Core treats it
// as inert data and revalidates the complete manifests.
-func rawRegistry(manifests []json.RawMessage) (json.RawMessage, error) {
+func RegistryInput(manifests []json.RawMessage) (json.RawMessage, error) {
type plugin struct {
Manifest json.RawMessage `json:"manifest"`
}
@@ -56,7 +56,7 @@ func Load(ctx context.Context, kernel Kernel, root, directory string, manifests
if err != nil {
return Snapshot{}, err
}
- registryRequest, err := rawRegistry(manifests)
+ registryRequest, err := RegistryInput(manifests)
if err != nil {
return Snapshot{}, err
}
@@ -141,7 +141,7 @@ func Resolve(ctx context.Context, kernel Kernel, root, directory, tool, minimumV
if err != nil {
return Selection{}, err
}
- registryRequest, err := rawRegistry(manifests)
+ registryRequest, err := RegistryInput(manifests)
if err != nil {
return Selection{}, err
}
diff --git a/desktop/internal/workbench/app.go b/desktop/internal/workbench/app.go
index 8a2dfa14e3..a64e9bba72 100644
--- a/desktop/internal/workbench/app.go
+++ b/desktop/internal/workbench/app.go
@@ -754,6 +754,8 @@ func (a *App) openPlugins(options Options) {
a.plugins = service
service.Backend.SetInitializeTimeout(options.PluginInitializeTimeout)
service.Backend.SetToolResolver(a.resolveBackendTool)
+ service.Backend.SetToolEntryResolver(a.resolveBackendToolEntry)
+ service.LanguageTool = a.resolveLanguageTool
if err := service.AttachWorkbench(pluginWorkbench{app: a}); err != nil {
a.emit(operationFailedLevel, operationFailedEvent, operationFailedFields("plugin_host_services", err))
}
diff --git a/desktop/internal/workbench/close_tab_shortcut_test.go b/desktop/internal/workbench/close_tab_shortcut_test.go
index 958ef07449..c5c7d0a215 100644
--- a/desktop/internal/workbench/close_tab_shortcut_test.go
+++ b/desktop/internal/workbench/close_tab_shortcut_test.go
@@ -40,10 +40,16 @@ func closeTabChord(t *testing.T, a *App) keymap.Chord {
return chord
}
chord := controlW(t)
- a.settings.Keymap = a.settings.Keymap.With(shortcuts.CloseTab, []keymap.Chord{chord})
+ bindCloseTab(a, chord)
return chord
}
+func bindCloseTab(a *App, chord keymap.Chord) {
+ a.settings.Keymap = a.settings.Keymap.With(shortcuts.CloseTab, []keymap.Chord{chord})
+ // Match SetKeymap: Pump paints only after an explicit invalidation.
+ a.invalidator.Invalidate()
+}
+
func controlW(t *testing.T) keymap.Chord {
t.Helper()
chord, ok := keymap.Parse(gfx.ModifierControl, "w")
@@ -85,6 +91,23 @@ func TestCloseTabShortcutClosesTheSelectedEditorTab(t *testing.T) {
awaitDocumentState(t, f.h, func() bool { return f.p.docs.find(f.d.id) == nil })
}
+// User bindings are installed after the log tab's frame on every platform,
+// including macOS where the default Command-W would hide a missing refresh.
+func TestCloseTabUserBindingClosesTheSelectedEditorTab(t *testing.T) {
+ f := newSemanticFixture(t)
+ openLSPLogFromStatus(f.h)
+ group := f.p.terms.bench.GroupOf(lspLogMember).ID
+ chord := controlW(t)
+ // Consume any pending paint before changing the binding; a background wake
+ // must not accidentally make the test's direct settings mutation visible.
+ pressCloseTab(t, f.h, chord)
+ bindCloseTab(f.h.app, chord)
+ pressCloseTab(t, f.h, chord)
+ if lspLogTabs(f.p) != 0 || f.p.selectedDocument(group) != f.d {
+ t.Fatalf("after the user chord: %d log tabs, the file selected %v", lspLogTabs(f.p), f.p.selectedDocument(group) == f.d)
+ }
+}
+
// With a terminal focused the chord closes the terminal's tab, not the file's tab in the editor.
func TestCloseTabShortcutClosesTheFocusedTerminal(t *testing.T) {
h := newHarness(t, &testKernel{Client: core.NewClient()})
diff --git a/desktop/internal/workbench/java_gradle_e2e_test.go b/desktop/internal/workbench/java_gradle_e2e_test.go
new file mode 100644
index 0000000000..afb6531b05
--- /dev/null
+++ b/desktop/internal/workbench/java_gradle_e2e_test.go
@@ -0,0 +1,60 @@
+package workbench
+
+import (
+ "context"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "runtime"
+ "strings"
+ "testing"
+ "time"
+)
+
+// The real wrapper and plugin archive are explicit integration inputs. The
+// unusual module directory and a library dependency exercise Gradle's own model,
+// Buildship classpaths and the same editor Run/Debug flow as a Maven project.
+func TestJavaPluginGradleLegacyReactor(t *testing.T) {
+ archive, wrapper, java8 := os.Getenv("LITHE_TEST_GRADLE_PLUGIN_ARCHIVE"), os.Getenv("LITHE_TEST_GRADLE_WRAPPER_DIR"), os.Getenv("LITHE_TEST_JAVA8_HOME")
+ if archive == "" || wrapper == "" || java8 == "" {
+ t.Skip("set LITHE_TEST_GRADLE_PLUGIN_ARCHIVE, LITHE_TEST_GRADLE_WRAPPER_DIR and LITHE_TEST_JAVA8_HOME")
+ }
+ gradleUserHome := t.TempDir()
+ t.Setenv("GRADLE_USER_HOME", gradleUserHome)
+ t.Setenv("JAVA_HOME", java8)
+ t.Cleanup(func() {
+ ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
+ defer cancel()
+ var command *exec.Cmd
+ if runtime.GOOS == "windows" {
+ command = exec.CommandContext(ctx, "cmd", "/c", filepath.Join(wrapper, "gradlew.bat"), "--stop")
+ } else {
+ command = exec.CommandContext(ctx, "/bin/sh", filepath.Join(wrapper, "gradlew"), "--stop")
+ }
+ command.WaitDelay = 3 * time.Second
+ if output, err := command.CombinedOutput(); err != nil {
+ t.Errorf("stop owned Gradle daemons: %v %s", err, output)
+ }
+ })
+ fixture := javaWorkflowFixture{
+ noMaven: true, javaHome: java8, vmVersion: "1.8", buildArchive: archive,
+ buildSystem: "gradle", buildProject: "old-app", buildTask: "compileJava",
+ mainPath: "模块 old app/src/main/java/demo/Main.java", classPath: "模块 old app/build/classes/java/main/demo/Main.class",
+ executablePaths: []string{"gradlew"},
+ files: map[string]string{
+ "settings.gradle": "rootProject.name='legacy-gradle'\ninclude 'old-lib', 'old-app'\nproject(':old-app').projectDir=file('模块 old app')\n",
+ "build.gradle": "subprojects { apply plugin: 'java'; sourceCompatibility='1.8'; targetCompatibility='1.8' }\nproject(':old-app') { dependencies { implementation project(':old-lib') } }\n",
+ "gradle.properties": "org.gradle.daemon=false\norg.gradle.workers.max=1\norg.gradle.jvmargs=-Xms32m -Xmx256m -XX:MaxMetaspaceSize=256m\norg.gradle.java.home=" + strings.ReplaceAll(java8, "\\", "/") + "\n",
+ "old-lib/src/main/java/demo/LegacyPart.java": `package demo; public class LegacyPart { public static String label() { return "java"; } }`,
+ },
+ }
+ fixture.files[fixture.mainPath] = strings.ReplaceAll(javaWorkflowMain, `org.apache.commons.lang3.StringUtils.reverse("avaj")`, `LegacyPart.label()`)
+ for _, name := range []string{"gradlew", "gradlew.bat", "gradle/wrapper/gradle-wrapper.jar", "gradle/wrapper/gradle-wrapper.properties"} {
+ data, err := os.ReadFile(filepath.Join(wrapper, name))
+ if err != nil {
+ t.Fatal(err)
+ }
+ fixture.files[name] = string(data)
+ }
+ runJavaPluginWorkflow(t, fixture)
+}
diff --git a/desktop/internal/workbench/java_legacy_e2e_test.go b/desktop/internal/workbench/java_legacy_e2e_test.go
index 65cf08d9e1..0df3e0ec23 100644
--- a/desktop/internal/workbench/java_legacy_e2e_test.go
+++ b/desktop/internal/workbench/java_legacy_e2e_test.go
@@ -5,6 +5,7 @@ import (
"io/fs"
"os"
"path/filepath"
+ "strconv"
"strings"
"testing"
)
@@ -24,13 +25,46 @@ func TestJavaPluginHistoricalProject(t *testing.T) {
}
probe := os.Getenv("LITHE_TEST_JAVA_HISTORICAL_PROBE")
java8 := os.Getenv("LITHE_TEST_JAVA8_HOME")
- if probe == "" || java8 == "" {
- t.Fatal("historical project requires a Java 8 home and a Java expression probing its API")
+ javaHome, vmVersion := java8, "1.8"
+ if selected := os.Getenv("LITHE_TEST_JAVA_HISTORICAL_HOME"); selected != "" {
+ javaHome, vmVersion = selected, os.Getenv("LITHE_TEST_JAVA_HISTORICAL_VM")
+ }
+ if probe == "" || javaHome == "" || vmVersion == "" {
+ t.Fatal("historical project requires a JDK home, expected VM version and a Java API probe")
}
fixture := standardJavaFixture()
- fixture.files = map[string]string{fixture.mainPath: strings.Replace(javaWorkflowMain, `org.apache.commons.lang3.StringUtils.reverse("avaj")`, `"java"`, 1)}
+ // Historical builds can check licenses before compilation. The injected
+ // test entry point carries this repository's Apache license, without
+ // disabling an upstream check or changing any upstream source file.
+ const probeLicense = `/*
+ * Copyright 2026 Lithe contributors.
+ *
+ * Licensed under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+`
+ fixture.files = map[string]string{fixture.mainPath: probeLicense + strings.Replace(javaWorkflowMain, `org.apache.commons.lang3.StringUtils.reverse("avaj")`, `"java"`, 1)}
fixture.files[fixture.mainPath] = strings.Replace(fixture.files[fixture.mainPath], `System.getProperty("java.specification.version")`, `System.getProperty("java.specification.version") + ";probe=" + (`+probe+`)`, 1)
- fixture.projectRoot, fixture.javaHome, fixture.vmVersion = root, java8, "1.8"
+ // A probe may call an upstream API with a checked exception. This changes
+ // only the injected entry point; the historical project stays untouched.
+ fixture.files[fixture.mainPath] = strings.Replace(fixture.files[fixture.mainPath], "main(String[] args) {", "main(String[] args) throws Exception {", 1)
+ fixture.projectRoot, fixture.javaHome, fixture.vmVersion = root, javaHome, vmVersion
+ if major := os.Getenv("LITHE_TEST_JAVA_HISTORICAL_CLASS_MAJOR"); major != "" {
+ value, err := strconv.ParseUint(major, 10, 8)
+ if err != nil || value < 45 {
+ t.Fatalf("invalid expected class version: %s", major)
+ }
+ fixture.classVersion = byte(value)
+ }
fixture.expectBuildRefused = os.Getenv("LITHE_TEST_JAVA_EXPECT_BUILD_REFUSAL") == "1"
if level := os.Getenv("LITHE_TEST_JAVA_HISTORICAL_SOURCE"); level != "" {
if level != "1.8" {
diff --git a/desktop/internal/workbench/java_performance_e2e_test.go b/desktop/internal/workbench/java_performance_e2e_test.go
new file mode 100644
index 0000000000..efc428a19a
--- /dev/null
+++ b/desktop/internal/workbench/java_performance_e2e_test.go
@@ -0,0 +1,116 @@
+package workbench
+
+import (
+ "context"
+ "crypto/sha256"
+ "encoding/hex"
+ "encoding/json"
+ "io"
+ "os"
+ "path/filepath"
+ "runtime"
+ "testing"
+ "time"
+
+ "github.com/1lck/Lithe-IDEA/desktop/internal/pluginservice"
+)
+
+// This opt-in probe measures real JDT/host processes and the production
+// completion path. Its headless host RSS is not native-window memory evidence.
+type javaPerformanceProbe struct {
+ Label string `json:"label"`
+ Test string `json:"test"`
+ Platform string `json:"platform"`
+ Architecture string `json:"architecture"`
+ ArchiveSHA string `json:"archiveSHA256"`
+ Passed bool `json:"passed"`
+ Milliseconds map[string]float64 `json:"milliseconds"`
+ CompletionMS []float64 `json:"completionMilliseconds"`
+ RSSBytes map[string]uint64 `json:"rssBytes"`
+}
+
+func newJavaPerformanceProbe(t *testing.T, archive string) *javaPerformanceProbe {
+ t.Helper()
+ report := os.Getenv("LITHE_TEST_JAVA_PERFORMANCE_REPORT")
+ if report == "" {
+ return nil
+ }
+ file, err := os.Open(archive)
+ if err != nil {
+ t.Fatal(err)
+ }
+ hash := sha256.New()
+ _, hashErr := io.Copy(hash, file)
+ closeErr := file.Close()
+ if hashErr != nil || closeErr != nil {
+ t.Fatalf("archive identity: read=%v close=%v", hashErr, closeErr)
+ }
+ probe := &javaPerformanceProbe{
+ Label: os.Getenv("LITHE_TEST_JAVA_PERFORMANCE_LABEL"), Test: t.Name(),
+ Platform: runtime.GOOS, Architecture: runtime.GOARCH,
+ ArchiveSHA: hex.EncodeToString(hash.Sum(nil)),
+ Milliseconds: make(map[string]float64), RSSBytes: make(map[string]uint64),
+ }
+ t.Cleanup(func() {
+ probe.Passed = !t.Failed()
+ if err := os.MkdirAll(filepath.Dir(report), 0700); err != nil {
+ t.Errorf("performance report directory: %v", err)
+ return
+ }
+ file, err := os.OpenFile(report, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
+ if err != nil {
+ t.Errorf("performance report: %v", err)
+ return
+ }
+ if err := json.NewEncoder(file).Encode(probe); err != nil {
+ t.Errorf("performance report record: %v", err)
+ }
+ if err := file.Close(); err != nil {
+ t.Errorf("performance report close: %v", err)
+ }
+ })
+ return probe
+}
+
+func (p *javaPerformanceProbe) elapsed(stage string, start time.Time) {
+ if p != nil {
+ p.Milliseconds[stage] = float64(time.Since(start)) / float64(time.Millisecond)
+ }
+}
+
+func (p *javaPerformanceProbe) sample(t *testing.T, h *harness, d *document, stage string) {
+ t.Helper()
+ if p == nil {
+ return
+ }
+ server, _ := h.app.documentSyncServer(d)
+ if server == nil {
+ t.Fatal("performance sample has no Java server")
+ }
+ for name, pid := range map[string]int{"jdt": server.session.Session.ProcessID, "headlessHostTree": os.Getpid()} {
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ sample, ok := pluginservice.SampleProcessTree(ctx, pid)
+ cancel()
+ if !ok || sample.MemoryBytes == 0 {
+ t.Fatalf("performance sample unavailable: %s", name)
+ }
+ p.RSSBytes[stage+"."+name] = sample.MemoryBytes
+ }
+}
+
+func (p *javaPerformanceProbe) completions(t *testing.T, h *harness, project *project, d *document, line, column int) {
+ t.Helper()
+ if p == nil {
+ return
+ }
+ for range 12 {
+ start := time.Now()
+ h.app.startPluginCompletion(project, d, line, column)
+ awaitStateWithin(t, h, 30*time.Second, "performance completion", func() bool {
+ return len(h.app.semantics.completion.items) > 0
+ })
+ p.CompletionMS = append(p.CompletionMS, float64(time.Since(start))/float64(time.Millisecond))
+ h.app.closeSemanticCompletion()
+ }
+ p.sample(t, h, d, "warmCompletion")
+}
diff --git a/desktop/internal/workbench/java_plugin_e2e_test.go b/desktop/internal/workbench/java_plugin_e2e_test.go
index 476acbf8df..d73ec8f077 100644
--- a/desktop/internal/workbench/java_plugin_e2e_test.go
+++ b/desktop/internal/workbench/java_plugin_e2e_test.go
@@ -2,9 +2,12 @@ package workbench
import (
"context"
+ "encoding/json"
"errors"
+ "io"
"os"
"path/filepath"
+ "strconv"
"strings"
"testing"
"time"
@@ -41,7 +44,15 @@ type javaWorkflowFixture struct {
projectRoot string
expectBuildRefused bool
testGoal bool
+ packageGoal bool
cleanupWhilePaused bool
+ documentProbe *javaDocumentProbe
+ buildArchive string
+ buildSystem string
+ buildProject string
+ buildTask string
+ executablePaths []string
+ temporaryClasspath bool
}
func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
@@ -58,6 +69,16 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
if mavenArchive == "" {
t.Skip("set LITHE_TEST_MAVEN_PLUGIN_ARCHIVE to the compatible Maven plugin zip")
}
+ // Core's diagnostic queue is process-wide. These fixtures run serially;
+ // scope terminal-fact assertions to this workflow rather than counting
+ // a preceding cleanup-only fixture's successful runs as ours.
+ drainContext, drainCancel := context.WithTimeout(context.Background(), 5*time.Second)
+ _, drainErr := core.NewClient().DrainCoreEvents(drainContext)
+ drainCancel()
+ if drainErr != nil {
+ t.Fatal(drainErr)
+ }
+ performance := newJavaPerformanceProbe(t, archive)
preferences := store.At(t.TempDir())
if err := os.WriteFile(filepath.Join(preferences.Dir(), settingsFile), []byte(`{"theme":"dark","autoSave":false}`), 0600); err != nil {
t.Fatal(err)
@@ -121,6 +142,23 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
t.Fatal(err)
}
mavenBefore := packageDigest(t, mavenInstalled.Path)
+ var extraPath string
+ var extraBefore map[string]string
+ if fixture.buildArchive != "" {
+ extraPlan, err := service.Installer.Prepare(ctx, plugininstall.Request{ArchivePath: fixture.buildArchive, Root: service.Root, Source: plugintrust.Disk})
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Cleanup(func() { _ = service.Installer.Discard(extraPlan) })
+ extra, err := service.Installer.Commit(extraPlan)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := service.Manager.SetEnabled(extraPlan.ID, true); err != nil {
+ t.Fatal(err)
+ }
+ extraPath, extraBefore = extra.Path, packageDigest(t, extra.Path)
+ }
before := packageDigest(t, installed.Path)
closeAndVerify := func() {
h.app.closeProject()
@@ -128,6 +166,9 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
h.settle()
assertPackageUnchanged(t, installed.Path, before)
assertPackageUnchanged(t, mavenInstalled.Path, mavenBefore)
+ if extraPath != "" {
+ assertPackageUnchanged(t, extraPath, extraBefore)
+ }
}
logger := &treeRecordingLog{}
h.app.logSink = logger
@@ -150,9 +191,37 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
copyHistoricalJavaProject(t, fixture.projectRoot, root)
}
writeFixture(t, root, fixture.files)
+ for _, name := range fixture.executablePaths {
+ if err := os.Chmod(filepath.Join(root, name), 0700); err != nil {
+ t.Fatal(err)
+ }
+ }
gitRun(t, root, "init")
h.open(root)
p := h.app.project
+ if fixture.buildSystem != "" {
+ h.app.loadBuildSystems(p)
+ instance := awaitBuildModel(t, h, p, fixture.buildSystem, 120*time.Second)
+ project := modelProjectNamed(instance.Model, fixture.buildProject)
+ if project == nil {
+ t.Fatalf("missing project %s: %+v", fixture.buildProject, instance.Model.Projects)
+ }
+ var taskID string
+ for _, task := range instance.Model.Tasks {
+ if task.ProjectID == project.ID && task.Name == fixture.buildTask {
+ taskID = task.ID
+ break
+ }
+ }
+ if taskID == "" {
+ t.Fatalf("missing task %s", fixture.buildTask)
+ }
+ output := runBuildTaskToEnd(t, h, p, project.ID, taskID, 90*time.Second)
+ if !strings.Contains(output, "BUILD SUCCESSFUL") {
+ t.Fatalf("Gradle compile: %s", output)
+ }
+ t.Log("Gradle multi-project model and compile succeeded")
+ }
if !fixture.noMaven {
h.app.loadBuildSystems(p)
awaitBuildModel(t, h, p, "maven", 90*time.Second)
@@ -168,18 +237,23 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
}
t.Log("legacy test framework: Maven test goal passed one test")
}
- if fixture.classVersion != 0 {
- compiled, err := os.ReadFile(filepath.Join(root, fixture.classPath))
- if err != nil || len(compiled) < 8 || compiled[7] != fixture.classVersion {
- t.Fatalf("Maven class target: header=%x err=%v, expected major %d", compiled[:min(len(compiled), 8)], err, fixture.classVersion)
+ if fixture.packageGoal {
+ output := runBuildTaskToEnd(t, h, p, "", "package", 120*time.Second)
+ if !strings.Contains(output, "BUILD SUCCESS") {
+ t.Fatalf("WAR package failed: %s", output)
}
}
+ if fixture.classVersion != 0 {
+ assertJavaClassVersion(t, filepath.Join(root, fixture.classPath), fixture.classVersion)
+ }
}
+ openedJava := time.Now()
h.app.openFile(p, filepath.Join(root, fixture.mainPath))
awaitStateWithin(t, h, 30*time.Second, "Java document", func() bool { return documentNamed(p, "Main.java") != nil })
d := documentNamed(p, "Main.java")
defer func() {
if t.Failed() {
+ retainJavaFailureLogs(t, service.Root, plan.ID)
t.Logf("document language=%s actions=%d ", d.languageID, len(d.actions))
t.Logf("notice=%s debug state=%s failure=%s", h.app.notice, p.debug.state, p.debug.failure)
t.Logf("JDT problems: %v", problemMessages(h.app))
@@ -195,6 +269,18 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
}
for id, server := range h.app.pluginServers {
t.Logf("server %s ready=%v", id, server.isReady())
+ t.Logf("document sync: %+v", d.sync)
+ for _, line := range server.logs[max(0, len(server.logs)-20):] {
+ t.Logf("server log %s: %s", line.level, line.text)
+ }
+ probeContext, probeCancel := context.WithTimeout(context.Background(), 5*time.Second)
+ methods, probeErr := service.ExecuteLanguageCommand(probeContext, server.session, "vscode.java.resolveMainMethod", []any{d.sync.uri}, 5*time.Second)
+ probeCancel()
+ t.Logf("late main methods: %s err=%v", methods, probeErr)
+ testContext, testCancel := context.WithTimeout(context.Background(), 5*time.Second)
+ tests, testErr := service.ExecuteLanguageCommand(testContext, server.session, "vscode.java.test.findTestTypesAndMethods", []any{d.sync.uri}, 5*time.Second)
+ testCancel()
+ t.Logf("late test items: %s err=%v", tests, testErr)
}
}
}()
@@ -202,12 +288,17 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
server, _ := h.app.documentSyncServer(d)
return server != nil && server.isReady()
})
- awaitStateWithin(t, h, 15*time.Second, "JDT editor actions", func() bool {
+ // LSP initialize can finish before the Java import's ServiceReady gate.
+ // Wait for real editor actions through that bounded import, including cold
+ // Gradle on Windows, rather than imposing a 15-second second startup budget.
+ awaitStateWithin(t, h, 120*time.Second, "JDT editor actions", func() bool {
if len(d.actions) > 0 {
return true
}
return false
})
+ performance.elapsed("javaOpenToActions", openedJava)
+ performance.sample(t, h, d, "ready")
t.Logf("Run/Debug action ready: %s", d.actions[0].Title)
if server, _ := h.app.documentSyncServer(d); server != nil {
sampleContext, cancelSample := context.WithTimeout(context.Background(), 5*time.Second)
@@ -217,11 +308,19 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
t.Logf("JDT process tree RSS after import: %.1f MiB", float64(sample.MemoryBytes)/(1024*1024))
}
}
- if !d.view.GoToNavigation(5, 13, false) {
+ // Real build plugins may prepend license headers. Locate the probes in the
+ // document actually opened after the build, rather than stale fixture lines.
+ openedContent, _ := d.view.Text()
+ content = string(openedContent)
+ completionLine, completionColumn := javaFixturePosition(t, content, "System.out.", true)
+ breakpointLine, breakpointColumn := javaFixturePosition(t, content, "answer += 1;", false)
+ if !d.view.GoToNavigation(completionLine, completionColumn, false) {
t.Fatal("completion caret")
}
- h.app.startPluginCompletion(p, d, 5, 13)
+ completionStarted := time.Now()
+ h.app.startPluginCompletion(p, d, completionLine, completionColumn)
awaitStateWithin(t, h, 30*time.Second, "JDT completion", func() bool { return len(h.app.semantics.completion.items) > 0 })
+ performance.elapsed("firstCompletion", completionStarted)
found := false
for _, item := range h.app.semantics.completion.items {
if strings.Contains(item.Label, "println") {
@@ -233,7 +332,12 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
}
t.Logf("JDT completion: %d candidates including println", len(h.app.semantics.completion.items))
h.app.closeSemanticCompletion()
+ performance.completions(t, h, p, d, completionLine, completionColumn)
+ if fixture.documentProbe != nil {
+ fixture.documentProbe.prepare(t, h, p, d)
+ }
noticeBeforeRun := h.app.notice
+ runStarted := time.Now()
h.app.runEditorAction(p, d, d.actions[0], -1)
if fixture.expectBuildRefused {
// This is an explicit compatibility-boundary test, not a passing full
@@ -269,7 +373,10 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
t.Fatalf("Java run refused: %s", h.app.notice)
}
for _, r := range p.build.runs {
- if !r.running && strings.Contains(strings.Join(r.output, ""), "java-result=42") {
+ if !r.running {
+ if !strings.Contains(strings.Join(r.output, ""), "java-result=42") {
+ t.Fatalf("Java run exited without the expected result: %s %s", r.summary, strings.Join(r.output, ""))
+ }
if fixture.vmVersion != "" && !strings.Contains(strings.Join(r.output, ""), "vm="+fixture.vmVersion) {
t.Fatalf("wrong project JVM: %s", strings.Join(r.output, ""))
}
@@ -278,11 +385,35 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
}
return false
})
- if _, err := os.Stat(filepath.Join(root, fixture.classPath)); err != nil {
- t.Fatalf("compiled class: %v", err)
+ performance.elapsed("buildAndRun", runStarted)
+ if fixture.temporaryClasspath {
+ data, err := os.ReadFile(filepath.Join(root, "run-classpath.txt"))
+ if err != nil || len(data) > 4096 {
+ t.Fatalf("shortened classpath evidence: bytes=%d err=%v", len(data), err)
+ }
+ path := strings.TrimSpace(string(data))
+ if filepath.Base(path) != "classpath.jar" {
+ t.Fatalf("Windows launch did not use a manifest JAR: %s", path)
+ }
+ awaitStateWithin(t, h, 5*time.Second, "temporary classpath cleanup", func() bool {
+ _, err := os.Stat(path)
+ if err != nil && !os.IsNotExist(err) {
+ t.Fatal(err)
+ }
+ return os.IsNotExist(err)
+ })
+ t.Log("Windows long classpath used a temporary manifest JAR and removed it after exit")
+ }
+ if fixture.classPath != "" {
+ if _, err := os.Stat(filepath.Join(root, fixture.classPath)); err != nil {
+ t.Fatalf("compiled class: %v", err)
+ }
+ if fixture.classVersion != 0 {
+ assertJavaClassVersion(t, filepath.Join(root, fixture.classPath), fixture.classVersion)
+ }
}
t.Log("compiled Main.class and ran java-result=42")
- if !d.view.GoToNavigation(4, 2, false) {
+ if !d.view.GoToNavigation(breakpointLine, breakpointColumn, false) {
t.Fatal("breakpoint caret")
}
h.app.toggleBreakpoint(p)
@@ -290,6 +421,7 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
logger.events = nil
logger.mu.Unlock()
t.Log("starting Java breakpoint session")
+ debugStarted := time.Now()
h.app.runEditorAction(p, d, d.actions[0], 0)
awaitStateWithin(t, h, 90*time.Second, "Java breakpoint", func() bool {
if len(p.build.runs) > 1 {
@@ -312,7 +444,7 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
}
return p.debug.state == "paused" && len(p.debug.frames) > 0
})
- if frame := p.debug.frames[0]; !strings.Contains(frame.Name, "Main.main") || frame.Line != 5 {
+ if frame := p.debug.frames[0]; !strings.Contains(frame.Name, "Main.main") || frame.Line != int64(breakpointLine+1) {
t.Fatalf("wrong breakpoint: %+v", frame)
}
t.Logf("Java paused in %s at line %d", p.debug.frames[0].Name, p.debug.frames[0].Line)
@@ -327,6 +459,7 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
return false
})
t.Log("Java local variable answer=41")
+ performance.elapsed("debugToLocals", debugStarted)
if fixture.cleanupWhilePaused {
// Return without the success-path closeAndVerify, just as an assertion
// failure would. t.Cleanup must stop the paused JVM and destroy Core state.
@@ -337,6 +470,10 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
return
}
h.app.executeDebug(p, "continue")
+ if fixture.documentProbe != nil {
+ fixture.documentProbe.awaitBreakpoint(t, h, p)
+ h.app.executeDebug(p, "continue")
+ }
awaitStateWithin(t, h, 30*time.Second, "debuggee exit", func() bool { return p.debug.activeSession() == nil })
awaitStateWithin(t, h, 15*time.Second, "run exit notifications", func() bool {
for _, r := range p.build.runs {
@@ -353,6 +490,11 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
awaitStateWithin(t, h, 90*time.Second, "second Java breakpoint", func() bool {
return p.debug.activeSession() != nil && p.debug.state == "paused"
})
+ if fixture.documentProbe != nil {
+ h.app.executeDebug(p, "continue")
+ fixture.documentProbe.awaitBreakpoint(t, h, p)
+ }
+ stopStarted := time.Now()
h.app.stopDebugByUser(p)
awaitStateWithin(t, h, 30*time.Second, "cancelled Java debuggee", func() bool {
if p.debug.activeSession() != nil {
@@ -365,6 +507,7 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
}
return true
})
+ performance.elapsed("debugStop", stopStarted)
t.Log("Java debug cancellation stopped the run")
// A failed compilation must never execute the successful build's old class.
@@ -385,6 +528,36 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
t.Fatal("compiler errors launched stale bytecode")
}
+ if fixture.buildSystem == "gradle" {
+ workspace, exists := service.Contexts.ByPath(root)
+ if !exists {
+ t.Fatal("Gradle workspace context was lost")
+ }
+ params, err := json.Marshal(map[string]string{"workspaceRoot": root})
+ if err != nil {
+ t.Fatal(err)
+ }
+ reference, err := json.Marshal(workspace.ContextRef)
+ if err != nil {
+ t.Fatal(err)
+ }
+ settingsContext, settingsCancel := context.WithTimeout(context.Background(), 15*time.Second)
+ answer, err := service.Host.Call(settingsContext, "io.github.lithe-idea.gradle-build", "languageImport.settings", params, reference, 10*time.Second)
+ settingsCancel()
+ if err != nil {
+ t.Fatalf("real Gradle import settings: %v", err)
+ }
+ var settings struct {
+ Settings map[string]string `json:"settings"`
+ }
+ if err := json.Unmarshal(answer, &settings); err != nil {
+ t.Fatal(err)
+ }
+ if settings.Settings["java.import.gradle.user.home"] != os.Getenv("GRADLE_USER_HOME") || settings.Settings["java.import.gradle.java.home"] != strings.ReplaceAll(fixture.javaHome, "\\", "/") {
+ t.Fatalf("Gradle source-backed import settings differ: %s", answer)
+ }
+ }
+
// Inspect the real Core facts before a log-store writer consumes them. Collection
// is high frequency and must not add success INFO; user runs own one terminal fact.
logCtx, cancelLogs := context.WithTimeout(context.Background(), 5*time.Second)
@@ -398,6 +571,9 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
if event.Channel != "plugins/"+plan.ID+"/host" {
continue
}
+ if fixture.buildSystem == "gradle" && event.Fields["code"] == "relay.provider_timed_out" {
+ t.Fatal("cold Gradle settings relay timed out; a fallback is not full import verification")
+ }
operation, _ := event.Fields["operation"].(string)
if event.Event == "plugins.operation.finished" && operation == "java.collectActions" {
t.Fatal("high-frequency collection emitted success INFO")
@@ -425,9 +601,86 @@ func runJavaPluginWorkflow(t *testing.T, fixture javaWorkflowFixture) {
t.Fatalf("run terminal diagnostics: successes=%d failures=%d; events=%+v", successes, failures, events)
}
t.Log("compiler errors blocked stale class; Core logging success/failure and collection suppression verified")
+ performance.sample(t, h, d, "workflowEnd")
closeAndVerify()
}
+// javaFixturePosition returns zero-based editor coordinates for a controlled
+// ASCII probe in the current document; headers added by build tools are retained.
+func javaFixturePosition(t *testing.T, text, probe string, after bool) (int, int) {
+ t.Helper()
+ offset := strings.Index(text, probe)
+ if offset < 0 {
+ t.Fatalf("fixture probe missing: %s", probe)
+ }
+ if after {
+ offset += len(probe)
+ }
+ prefix := text[:offset]
+ return strings.Count(prefix, "\n"), len(prefix) - strings.LastIndex(prefix, "\n") - 1
+}
+
+// Opt-in local evidence for public integration fixtures. Read only the known
+// JDT log locations, at most 32 workspace entries and 1 MiB from each log.
+func retainJavaFailureLogs(t *testing.T, pluginRoot, pluginID string) {
+ t.Helper()
+ output := os.Getenv("LITHE_TEST_JAVA_DIAGNOSTICS_DIR")
+ if output == "" {
+ return
+ }
+ if err := os.MkdirAll(output, 0700); err != nil {
+ t.Logf("diagnostic directory: %v", err)
+ return
+ }
+ base := filepath.Join(pluginRoot, ".state", pluginID)
+ paths := []string{filepath.Join(base, "logs", "jdt.log")}
+ entries, err := os.ReadDir(filepath.Join(base, "servers", "java", "workspaces"))
+ if err != nil && !os.IsNotExist(err) {
+ t.Logf("diagnostic workspace list: %v", err)
+ }
+ for _, entry := range entries[:min(len(entries), 32)] {
+ if entry.IsDir() {
+ paths = append(paths, filepath.Join(base, "servers", "java", "workspaces", entry.Name(), "data", ".metadata", ".log"))
+ }
+ }
+ for index, path := range paths {
+ file, err := os.Open(path)
+ if os.IsNotExist(err) {
+ continue
+ }
+ if err != nil {
+ t.Logf("diagnostic log: %v", err)
+ continue
+ }
+ data, readErr := io.ReadAll(io.LimitReader(file, 1<<20))
+ closeErr := file.Close()
+ if readErr != nil || closeErr != nil {
+ t.Logf("diagnostic read=%v close=%v", readErr, closeErr)
+ continue
+ }
+ name := strings.ReplaceAll(t.Name(), "/", "_") + "-" + strconv.Itoa(index) + ".log"
+ if err := os.WriteFile(filepath.Join(output, name), data, 0600); err != nil {
+ t.Logf("diagnostic write: %v", err)
+ }
+ }
+}
+
+// Check the emitted target after both the build tool and JDT's pre-run build.
+// The read is fixed-size even when an upstream tool emits a large class file.
+func assertJavaClassVersion(t *testing.T, path string, expected byte) {
+ t.Helper()
+ file, err := os.Open(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var header [8]byte
+ _, readErr := io.ReadFull(file, header[:])
+ closeErr := file.Close()
+ if readErr != nil || closeErr != nil || [4]byte(header[:4]) != [4]byte{0xca, 0xfe, 0xba, 0xbe} || header[6] != 0 || header[7] != expected {
+ t.Fatalf("class target: header=%x read=%v close=%v expected major=%d", header, readErr, closeErr, expected)
+ }
+}
+
func TestJavaPluginCurrentManifestContract(t *testing.T) {
path := os.Getenv("LITHE_TEST_JAVA_PLUGIN_MANIFEST")
if path == "" {
diff --git a/desktop/internal/workbench/java_unmanaged_e2e_test.go b/desktop/internal/workbench/java_unmanaged_e2e_test.go
new file mode 100644
index 0000000000..f39c6f02ef
--- /dev/null
+++ b/desktop/internal/workbench/java_unmanaged_e2e_test.go
@@ -0,0 +1,101 @@
+package workbench
+
+import (
+ "archive/zip"
+ "bytes"
+ "fmt"
+ "os"
+ "runtime"
+ "strings"
+ "testing"
+)
+
+// These workflows deliberately have no POM or Gradle model. The Ant case
+// exercises JDT's source import, not an Ant target-discovery provider.
+func TestJavaPluginUnmanagedProjects(t *testing.T) {
+ if os.Getenv("LITHE_TEST_JAVA_UNMANAGED") != "1" {
+ t.Skip("set LITHE_TEST_JAVA_UNMANAGED=1 and LITHE_TEST_JAVA8_HOME")
+ }
+ java8 := os.Getenv("LITHE_TEST_JAVA8_HOME")
+ if java8 == "" {
+ t.Fatal("unmanaged legacy projects require LITHE_TEST_JAVA8_HOME")
+ }
+ plainMain := strings.ReplaceAll(javaWorkflowMain, `org.apache.commons.lang3.StringUtils.reverse("avaj")`, `"java"`)
+ for _, kind := range []string{"plain-source", "plain-library", "ant-source-tree", "eclipse-multiple-roots"} {
+ t.Run(kind, func(t *testing.T) {
+ fixture := javaWorkflowFixture{
+ files: map[string]string{"src/demo/Main.java": plainMain}, mainPath: "src/demo/Main.java",
+ javaHome: java8, vmVersion: "1.8", noMaven: true,
+ }
+ switch kind {
+ case "plain-library":
+ jar := os.Getenv("LITHE_TEST_JAVA_REFERENCE_JAR")
+ if jar == "" {
+ t.Fatal("set LITHE_TEST_JAVA_REFERENCE_JAR to commons-lang3 3.17.0")
+ }
+ info, err := os.Stat(jar)
+ if err != nil || !info.Mode().IsRegular() || info.Size() > 8<<20 {
+ t.Fatalf("reference JAR must be a regular file below 8 MiB: %v", err)
+ }
+ data, err := os.ReadFile(jar)
+ if err != nil {
+ t.Fatal(err)
+ }
+ fixture.files[fixture.mainPath] = javaWorkflowMain
+ fixture.files["lib/commons-lang3.jar"] = string(data)
+ case "ant-source-tree":
+ fixture.mainPath = "old-source/demo/Main.java"
+ fixture.files = map[string]string{
+ fixture.mainPath: plainMain,
+ "build.xml": ``,
+ }
+ case "eclipse-multiple-roots":
+ fixture.files[".project"] = `legacy-eclipseorg.eclipse.jdt.core.javabuilderorg.eclipse.jdt.core.javanature`
+ fixture.files[".classpath"] = ``
+ fixture.files["generated-source/demo/LegacyPart.java"] = `package demo; public class LegacyPart { public static String label() { return "java"; } }`
+ fixture.files[fixture.mainPath] = strings.ReplaceAll(javaWorkflowMain, `org.apache.commons.lang3.StringUtils.reverse("avaj")`, `LegacyPart.label()`)
+ fixture.classPath = "classes/demo/Main.class"
+ }
+ runJavaPluginWorkflow(t, fixture)
+ })
+ }
+}
+
+// Empty valid JARs stress the real Windows command-line boundary without
+// creating hundreds of copies of a large dependency or a false memory load.
+func TestJavaPluginWindowsLongClasspath(t *testing.T) {
+ if runtime.GOOS != "windows" || os.Getenv("LITHE_TEST_JAVA_LONG_CLASSPATH") != "1" {
+ t.Skip("Windows integration: set LITHE_TEST_JAVA_LONG_CLASSPATH=1")
+ }
+ java8, jar := os.Getenv("LITHE_TEST_JAVA8_HOME"), os.Getenv("LITHE_TEST_JAVA_REFERENCE_JAR")
+ if java8 == "" || jar == "" {
+ t.Fatal("the Windows legacy classpath requires Java 8 and commons-lang3")
+ }
+ data, err := os.ReadFile(jar)
+ if err != nil || len(data) > 8<<20 {
+ t.Fatalf("reference JAR: %v", err)
+ }
+ var buffer bytes.Buffer
+ archive := zip.NewWriter(&buffer)
+ manifest, err := archive.Create("META-INF/MANIFEST.MF")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err := manifest.Write([]byte("Manifest-Version: 1.0\r\n\r\n")); err != nil {
+ t.Fatal(err)
+ }
+ if err := archive.Close(); err != nil {
+ t.Fatal(err)
+ }
+ main := strings.Replace(javaWorkflowMain, "\n }\n}\n", `
+ try { java.nio.file.Files.write(java.nio.file.Paths.get("run-classpath.txt"), System.getProperty("java.class.path").getBytes(java.nio.charset.StandardCharsets.UTF_8)); }
+ catch (java.io.IOException error) { throw new RuntimeException(error); }
+ }
+}
+`, 1)
+ fixture := javaWorkflowFixture{files: map[string]string{"src/demo/Main.java": main, "lib/zz-real/commons-lang3.jar": string(data)}, mainPath: "src/demo/Main.java", javaHome: java8, vmVersion: "1.8", noMaven: true, temporaryClasspath: true}
+ for i := range 300 {
+ fixture.files[fmt.Sprintf("lib/中文 old module-with-extra-long-legacy-package-layout-%03d/empty.jar", i)] = buffer.String()
+ }
+ runJavaPluginWorkflow(t, fixture)
+}
diff --git a/desktop/internal/workbench/java_web_e2e_test.go b/desktop/internal/workbench/java_web_e2e_test.go
new file mode 100644
index 0000000000..db0214a2e9
--- /dev/null
+++ b/desktop/internal/workbench/java_web_e2e_test.go
@@ -0,0 +1,138 @@
+package workbench
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+ "time"
+)
+
+// A second source proves servlet APIs resolve and a request-handling thread
+// can actually stop, inspect locals, continue, and stop with its owned JVM.
+type javaDocumentProbe struct {
+ path string
+ completionLine int
+ completionCol int
+ completion string
+ breakpointLine int
+ frame string
+}
+
+func (probe *javaDocumentProbe) prepare(t *testing.T, h *harness, p *project, main *document) {
+ t.Helper()
+ h.app.openFile(p, filepath.Join(p.root, probe.path))
+ awaitStateWithin(t, h, 30*time.Second, "servlet source", func() bool { return p.docs.byPath(filepath.Join(p.root, probe.path)) != nil })
+ d := p.docs.byPath(filepath.Join(p.root, probe.path))
+ if !d.view.GoToNavigation(probe.completionLine, probe.completionCol, false) {
+ t.Fatal("servlet completion caret")
+ }
+ h.app.startPluginCompletion(p, d, probe.completionLine, probe.completionCol)
+ awaitStateWithin(t, h, 30*time.Second, "servlet API completion", func() bool {
+ for _, item := range h.app.semantics.completion.items {
+ if strings.Contains(item.Label, probe.completion) {
+ return true
+ }
+ }
+ return false
+ })
+ h.app.closeSemanticCompletion()
+ if !d.view.GoToNavigation(probe.breakpointLine, 2, false) {
+ t.Fatal("servlet breakpoint caret")
+ }
+ h.app.toggleBreakpoint(p)
+ h.app.selectDocument(p, main.id)
+ awaitStateWithin(t, h, 10*time.Second, "main source selected", func() bool { return p.selectedDocument(p.docs.group) == main })
+ t.Log("servlet API completion and request-handler breakpoint prepared")
+}
+
+func (probe *javaDocumentProbe) awaitBreakpoint(t *testing.T, h *harness, p *project) {
+ t.Helper()
+ awaitStateWithin(t, h, 60*time.Second, "servlet request breakpoint", func() bool {
+ return p.debug.activeSession() != nil && p.debug.state == "paused" && len(p.debug.frames) > 0 && strings.Contains(p.debug.frames[0].Name, probe.frame)
+ })
+ awaitStateWithin(t, h, 15*time.Second, "servlet local variable", func() bool {
+ for _, scope := range p.debug.vars.scopes {
+ if scope.container != nil {
+ if node := findDebugVariable(scope.container.nodes, "answer"); node != nil && node.value == "41" {
+ return true
+ }
+ }
+ }
+ return false
+ })
+ t.Log("servlet request paused with answer=41")
+}
+
+// This is a real javax Servlet/JSP application: Maven creates its WAR, embedded
+// Tomcat serves HTTP, Jasper compiles JSP/EL/JSTL, and Java handlers are debugged.
+// It does not claim JSP editor semantics, JSP line breakpoints or deployment
+// into an externally managed application server.
+func TestJavaPluginLegacyJspWar(t *testing.T) {
+ if os.Getenv("LITHE_TEST_JAVA_WEB") != "1" {
+ t.Skip("set LITHE_TEST_JAVA_WEB=1 and LITHE_TEST_JAVA8_HOME")
+ }
+ java8 := os.Getenv("LITHE_TEST_JAVA8_HOME")
+ if java8 == "" {
+ t.Fatal("the legacy JSP application requires LITHE_TEST_JAVA8_HOME")
+ }
+ fixture := standardJavaFixture()
+ pom := javaFixturePOM("1.8", `maven-war-plugin3.4.0false`)
+ pom = strings.Replace(pom, "1.0", "1.0war", 1)
+ pom = strings.Replace(pom, "", `org.apache.tomcat.embedtomcat-embed-core9.0.82org.apache.tomcat.embedtomcat-embed-jasper9.0.82javax.servletjstl1.2`, 1)
+ fixture.files["pom.xml"] = pom
+ fixture.files[fixture.mainPath] = strings.Replace(javaWorkflowMain, `org.apache.commons.lang3.StringUtils.reverse("avaj")`, "LegacyWeb.render()", 1)
+ fixture.files["src/main/java/demo/ProbeServlet.java"] = `package demo;
+public class ProbeServlet extends javax.servlet.http.HttpServlet {
+ protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException {
+ int answer = 41;
+ answer += 1;
+ response.getWriter().print("servlet-result=" + answer);
+ }
+}
+`
+ fixture.files["src/main/java/demo/LegacyWeb.java"] = `package demo;
+public class LegacyWeb {
+ public static String render() {
+ org.apache.catalina.startup.Tomcat server = new org.apache.catalina.startup.Tomcat();
+ server.setBaseDir(new java.io.File("target/tomcat").getAbsolutePath());
+ server.setPort(0);
+ server.getConnector().setProperty("address", "127.0.0.1");
+ org.apache.catalina.Context context = server.addWebapp("", new java.io.File("src/main/webapp").getAbsolutePath());
+ context.setParentClassLoader(LegacyWeb.class.getClassLoader());
+ org.apache.catalina.startup.Tomcat.addServlet(context, "probe", new ProbeServlet());
+ context.addServletMappingDecoded("/probe", "probe");
+ try {
+ server.start();
+ int port = server.getConnector().getLocalPort();
+ if (!read(port, "/probe").contains("servlet-result=42")) throw new IllegalStateException("servlet response");
+ String jsp = read(port, "/index.jsp");
+ if (!jsp.contains("jsp-result=42;el=42;jstl=42")) throw new IllegalStateException("JSP/EL/JSTL response: " + jsp);
+ return "java";
+ } catch (Exception error) {
+ throw new RuntimeException(error);
+ } finally {
+ try { server.stop(); server.destroy(); } catch (Exception error) { throw new RuntimeException(error); }
+ }
+ }
+ private static String read(int port, String path) throws java.io.IOException {
+ java.net.HttpURLConnection connection = (java.net.HttpURLConnection) new java.net.URL("http://127.0.0.1:" + port + path).openConnection();
+ connection.setConnectTimeout(5000);
+ connection.setReadTimeout(60000);
+ try (java.io.InputStream stream = connection.getInputStream(); java.io.ByteArrayOutputStream bytes = new java.io.ByteArrayOutputStream()) {
+ byte[] buffer = new byte[1024];
+ for (int count; (count = stream.read(buffer)) >= 0;) {
+ if (bytes.size() + count > 65536) throw new java.io.IOException("response exceeds fixture limit");
+ bytes.write(buffer, 0, count);
+ }
+ return new String(bytes.toByteArray(), java.nio.charset.StandardCharsets.UTF_8);
+ } finally { connection.disconnect(); }
+ }
+}
+`
+ fixture.files["src/main/webapp/index.jsp"] = `<%@ page contentType="text/plain; charset=UTF-8" %><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><%@ include file="/WEB-INF/片段 旧.jspf" %>`
+ fixture.files["src/main/webapp/WEB-INF/片段 旧.jspf"] = `<% int value = 41; %>jsp-result=<%= value + 1 %>;el=${40+2};jstl=`
+ fixture.javaHome, fixture.vmVersion, fixture.classVersion, fixture.packageGoal = java8, "1.8", 52, true
+ fixture.documentProbe = &javaDocumentProbe{path: "src/main/java/demo/ProbeServlet.java", completionLine: 5, completionCol: 11, completion: "getWriter", breakpointLine: 4, frame: "ProbeServlet.doGet"}
+ runJavaPluginWorkflow(t, fixture)
+}
diff --git a/desktop/internal/workbench/official_plugins_e2e_test.go b/desktop/internal/workbench/official_plugins_e2e_test.go
index 0c73695a86..7ee24909d3 100644
--- a/desktop/internal/workbench/official_plugins_e2e_test.go
+++ b/desktop/internal/workbench/official_plugins_e2e_test.go
@@ -5,6 +5,7 @@ import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
+ "io"
"io/fs"
"os"
"os/exec"
@@ -68,13 +69,26 @@ func packageDigest(t *testing.T, root string) map[string]string {
if err != nil || entry.IsDir() {
return err
}
- data, err := os.ReadFile(path)
+ file, err := os.Open(path)
if err != nil {
return err
}
- sum := sha256.Sum256(data)
- relative, _ := filepath.Rel(root, path)
- digest[relative] = hex.EncodeToString(sum[:])
+ // JDK module images are large; stream the unchanged-package proof so
+ // test buffers do not inflate the headless host's memory observations.
+ sum := sha256.New()
+ _, readErr := io.Copy(sum, file)
+ closeErr := file.Close()
+ if readErr != nil {
+ return readErr
+ }
+ if closeErr != nil {
+ return closeErr
+ }
+ relative, err := filepath.Rel(root, path)
+ if err != nil {
+ return err
+ }
+ digest[relative] = hex.EncodeToString(sum.Sum(nil))
return nil
})
if err != nil {
diff --git a/desktop/internal/workbench/runs.go b/desktop/internal/workbench/runs.go
index d25fed5670..d8634a8cd0 100644
--- a/desktop/internal/workbench/runs.go
+++ b/desktop/internal/workbench/runs.go
@@ -2,6 +2,7 @@ package workbench
import (
"context"
+ "errors"
"path/filepath"
"strconv"
"strings"
@@ -11,6 +12,7 @@ import (
"github.com/1lck/Lithe-IDEA/desktop/internal/editorview"
"github.com/1lck/Lithe-IDEA/desktop/internal/pluginbackend"
"github.com/1lck/Lithe-IDEA/desktop/internal/pluginservice"
+ "github.com/1lck/Lithe-IDEA/desktop/internal/toolchain"
"github.com/vivaui/viva/ui"
)
@@ -90,6 +92,52 @@ func (a *App) resolveBackendTool(ctx context.Context, _, workingDirectory, tool
return pluginbackend.ToolExecutable{Path: resolved.Path, Environment: resolved.Environment}, nil
}
+// resolveBackendToolEntry supplies native installation facts and the verified
+// entry to Core. The definition, not the host, decides how a tool loads it.
+func (a *App) resolveBackendToolEntry(ctx context.Context, _ string, workingDirectory string, input pluginbackend.ToolEntryLaunch) (pluginbackend.ToolExecutable, error) {
+ selection := core.ToolchainSelection{Executable: input.Executable}
+ if selection.Executable == "" {
+ var err error
+ selection, err = a.resolveToolchainSelection(ctx, workingDirectory, ".", input.Tool, input.MinimumVersion)
+ if err != nil {
+ return pluginbackend.ToolExecutable{}, err
+ }
+ }
+ manifests, err := a.toolchainManifests(ctx)
+ if err != nil {
+ return pluginbackend.ToolExecutable{}, err
+ }
+ registry, err := toolchain.RegistryInput(manifests)
+ if err != nil {
+ return pluginbackend.ToolExecutable{}, err
+ }
+ home := ""
+ if selection.Home != nil {
+ home = *selection.Home
+ }
+ launch, err := a.kernel.InstantiateToolchainLaunch(ctx, registry, input.Tool, selection.Executable, home, input.Entry, input.RuntimeArguments, input.Arguments)
+ if err != nil {
+ return pluginbackend.ToolExecutable{}, err
+ }
+ return pluginbackend.ToolExecutable{Path: launch.Executable, Arguments: launch.Arguments, Environment: applyToolchainSelection(nil, selection)}, nil
+}
+
+// resolveLanguageTool supplies the complete installation selected by Core.
+// An unavailable optional tool leaves the language server's configuration alone;
+// actual I/O failures propagate to the existing server-start failure boundary.
+func (a *App) resolveLanguageTool(ctx context.Context, root, tool string) (*core.ToolchainSelection, error) {
+ selection, err := a.resolveToolchainSelection(ctx, root, ".", tool, "")
+ var unavailable *toolchain.UnavailableError
+ if errors.As(err, &unavailable) {
+ // log-exempt: 预期的缺失:可选安装不存在时,不覆盖语言服务器已有配置。
+ return nil, nil
+ }
+ if err != nil {
+ return nil, err
+ }
+ return &selection, nil
+}
+
// applyRunEvent shows one run event. Events of a workspace that is not open are
// dropped: the run keeps going, but there is nowhere to show it.
func (a *App) applyRunEvent(event pluginservice.RunEvent) {
diff --git a/scripts/desktop/build-desktop-core.sh b/scripts/desktop/build-desktop-core.sh
index 270dc246d4..4db9c34b9c 100755
--- a/scripts/desktop/build-desktop-core.sh
+++ b/scripts/desktop/build-desktop-core.sh
@@ -46,7 +46,7 @@ PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git"
# the contract, plugin guides, reference and SDKs live only in shared/plugins; on top of #16 (reported Git queries folded in the console),
# #15 (git.write cherryPick, revert and reset fields), #14 (word-level changed ranges of diff
# rows), #13, #8, #7, #6 and #4.
-PINNED_CORE_REVISION="0be1d34f8926fc284a23874a4f6a57a14e339de8"
+PINNED_CORE_REVISION="c0201c11e0c7c9ea304c42a346b86e6bb9f61358"
PROFILE="debug"
while [[ $# -gt 0 ]]; do
case "$1" in
diff --git a/shared/platform-feature-matrix/features/java-support-plugin.json b/shared/platform-feature-matrix/features/java-support-plugin.json
index eb5f2d68aa..70e831ff96 100644
--- a/shared/platform-feature-matrix/features/java-support-plugin.json
+++ b/shared/platform-feature-matrix/features/java-support-plugin.json
@@ -4,23 +4,31 @@
"group": "Java",
"capability": "Java 语言支持由独立插件 io.github.lithe-idea.java-support 提供:JDT LS、调试适配器、测试与运行入口由插件包和插件后端拥有,可安装、卸载和更新;宿主只提供通用的语言服务器、构建、工具链、调试适配器与插件函数中转契约,不内置任何 Java 逻辑",
"macos": {
- "implementationStatus": "missing",
+ "implementationStatus": "partial",
"verificationStatus": "pending",
"evidence": [
- "desktop/internal/core/plugin_session.go",
- ".agents/notes/proposed/architecture/2026-10-24-java-support-independent-distribution.md"
+ "desktop/internal/workbench/java_plugin_e2e_test.go",
+ "desktop/internal/workbench/java_legacy_e2e_test.go",
+ "desktop/internal/workbench/java_unmanaged_e2e_test.go",
+ "desktop/internal/workbench/java_web_e2e_test.go",
+ "desktop/internal/workbench/java_gradle_e2e_test.go",
+ ".agents/notes/implemented/bug-fix/2026-11-13-viva-plugin-run-debug-lifecycle.md"
]
},
"windows": {
- "implementationStatus": "missing",
+ "implementationStatus": "partial",
"verificationStatus": "pending",
"evidence": [
- "desktop/internal/core/plugin_session.go",
- ".agents/notes/proposed/architecture/2026-10-24-java-support-independent-distribution.md"
+ "desktop/internal/workbench/java_plugin_e2e_test.go",
+ "desktop/internal/workbench/java_legacy_e2e_test.go",
+ "desktop/internal/workbench/java_unmanaged_e2e_test.go",
+ "desktop/internal/workbench/java_web_e2e_test.go",
+ "desktop/internal/workbench/java_gradle_e2e_test.go",
+ ".agents/notes/implemented/bug-fix/2026-11-13-viva-plugin-run-debug-lifecycle.md"
]
},
"owner": "Java Support",
- "verification": "macOS:全新安装后打开插件管理,确认 Java Support 已安装且默认启用;打开 Maven 项目并点开 .java 文件,确认语言服务器启动,补全、诊断、跳转到 JDK 与依赖 jar 中的类(jdt://)、Lombok 生成的方法、运行标记可用;在打包出的应用里逐项确认宿主能力:工具栏调试能停在断点并继续,测试面板列出并能运行 Java 测试,“当前文件”与 Java main 运行配置能启动(Spring Boot 等 Maven 配置走另一条路径,不能替代这一项);用 lsof 或进程参数确认 JDT LS 及其 java 进程来自 Lithe.app/Contents/Resources/OfficialPlugins/dev.lithe.plugin.java-support,且应用内不存在 Contents/Resources/LanguageServers。卸载 Java Support 并重启:打开 .java 文件时提示需要安装或恢复该插件,语法高亮、Maven 面板和其他语言不受影响,/Lithe/PluginState 下该插件的目录被删除,app bundle 文件清单不变(scripts/desktop/verify/verify-runtime-bundle-immutability.sh)。点击恢复并重启后 Java 功能恢复。从旧版本升级:首次打开 Java 项目会重建一次索引,之后正常。Windows:JDT LS 与 JDK 仍随应用安装目录分发,尚未接入该插件契约。 独立分发第一阶段:PluginBundledPublisherTrustTests 使用真实 Core 和注入测试公钥覆盖内置副本、已签名更新、用户目录伪造 bundled 来源、缺失运行时与篡改拒绝;官方发布索引回归验证双架构哈希与 tag 对应 API/requires。正式发布包、Intel 真机和完整产品下载迁移仍待验收,releaseEnabled 保持 false。 后续迁移回归覆盖默认启用/显式禁用、跳过过渡版的安装、旧移除标记不清理新状态、卸载更新不恢复内置副本;缺包提示不触发自动安装。verify-macos-package.sh 的默认与 --slim 模式分别验证空索引保留资源及完整 fixture 索引省去资源;fixture 不代表真实市场已经上线。 安装入口与实时插件激活共用同一安装流程:普通、市场、磁盘安装各覆盖默认启用和显式禁用选择,成功后迁移并保留包字节,失败不写偏好;不改变其他插件的实时激活/撤回规则,Java 宿主集成仍等待重启。 缺包判断按安装状态而非快照 ID:真实安装→卸载→prepareForLaunch→重新扫描后,.removed 内置快照不再抑制 Java 文件和项目提示;已安装(含禁用)、暂存更新及仍待重启的卸载继续使用原管理流程。状态矩阵覆盖两种启用选择与四种 Java/Maven/Gradle 文件;深浅主题原生视图验证缺包通知与新建项目安装按钮,只在用户点击后发出市场搜索,不自动安装或执行工具。 macOS:Java Support 插件设置中的类和方法跳转默认关闭;启用后 Command 悬停/点击和定义命令可用,关闭及禁用插件后释放专属交互并拒绝旧回复,现有标签和分屏不关闭。插件详情及 Java 设置页共用插件值,不保留编辑器全局开关。settings 3 未在 Windows 声明,旧宿主须拒绝此能力要求。 全局跳转开关同步所有已有项目窗口,新项目读取存储值;双项目反复切换验证旧操作失效与对象释放。未声明 editorNavigation 的语言保留原有点击/F12,包含 MyBatis XML 属性、Spring properties/YAML 和其他 LSP;不增加其悬停查询。WebKit 100 次切换验证监听恢复基线、窗口监听清零及模型/编辑器数量不增长;该结果不是长期堆内存采样。 回归选择器接受虚拟源码目标后到达关闭回调,延迟源码仍打开;加载期间关闭功能则丢弃回复,用户取消仍清理 operation。真实 WebKit 验证插件语言 bash/properties 与 Monaco shell/ini 不同,以及共用 ini 语法的文档和分屏独立应用策略、同模型身份切换释放旧动作。 日志验证:最新本地宿主启动Java Support,确认osgi.logfile指向当前会话plugins//files/jdt.log,include.commandline=false,单文件1024KiB加两个备份,默认logLevel为WARNING;元数据和索引继续留在缓存/工作区状态,插件包字节不变。旧宿主/远程缺logDirectory按既有契约拒绝。本轮仅参数幂等和目录边界验证,真实JDT产生日志、轮转及UI未验收,verification保持pending。 macOS:该能力由独立的 Java/Maven/Gradle 插件(Lithe-IDEA/lithe-plugin-java、lithe-plugin-maven、lithe-plugin-gradle)实现,宿主只验证通用契约与接线,运行时验证记录归插件仓库。",
+ "verification": "Viva 显式无头集成使用真实独立插件 ZIP、隔离用户存储、JDT 与 java-debug,覆盖普通 Maven、Java 8 旧布局、多模块/Profile、外部 JAR、普通源码、Eclipse/Ant 源码布局、Gradle Wrapper reactor,以及 WAR/Tomcat 的 JSP HTTP 请求和 Servlet 断点;核对编译版本、补全、运行结果、变量、继续/停止、错误编译拒绝旧 class、关闭后进程清理与安装目录哈希。Ant 布局不等于执行 Ant target,JSP 请求/Servlet 调试不等于 JSP 源码断点或补全验收。需逐平台执行这些用例,并另验收原生窗口、导航/虚拟源码、行内测试、失败/取消和日志 UI。历史 Java 5/7 源码级别当前被 ECJ 拒绝,不能以安全拒绝测试表示支持。",
"legacy": {
"revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36",
"macos": {
@@ -49,5 +57,5 @@
"verificationStatus": "not-applicable"
}
},
- "notes": "Java 插件与 Store 位于独立组织仓库;Viva 已有部分 Core 桥接,但尚未接入插件安装、JDT 语言服务和 Java 运行调试,不能将插件仓库已有能力视为客户端已完成。legacy 是迁移前基线,不代表当前实现。"
+ "notes": "Java/Maven/Gradle 规则由独立社区插件和成熟上游实现,宿主复用通用安装、激活、工具事实、语言服务器、Run 与 Debug 接线。真实 ZIP 由显式输入提供,不代表已经发布、预装或进入市场。当前状态为部分实现、原生验收待完成;旧客户端与 legacy 证据不代表 Viva 验收。"
}
diff --git a/shared/platform-feature-matrix/features/keymap-customization.json b/shared/platform-feature-matrix/features/keymap-customization.json
index d57973dd41..1b46bcfb3e 100644
--- a/shared/platform-feature-matrix/features/keymap-customization.json
+++ b/shared/platform-feature-matrix/features/keymap-customization.json
@@ -14,7 +14,8 @@
"desktop/internal/core/keymap_gesture.go",
"desktop/internal/core/keymap_gesture_test.go",
"desktop/internal/settingswindow/keymap_schemes_view.go",
- "desktop/internal/settingswindow/editor_essentials_test.go"
+ "desktop/internal/settingswindow/editor_essentials_test.go",
+ "desktop/internal/workbench/close_tab_shortcut_test.go"
]
},
"windows": {
@@ -28,11 +29,12 @@
"desktop/internal/core/keymap_gesture.go",
"desktop/internal/core/keymap_gesture_test.go",
"desktop/internal/settingswindow/keymap_schemes_view.go",
- "desktop/internal/settingswindow/editor_essentials_test.go"
+ "desktop/internal/settingswindow/editor_essentials_test.go",
+ "desktop/internal/workbench/close_tab_shortcut_test.go"
]
},
"owner": "Settings",
- "verification": "新增范围:运行 desktop/internal/settingswindow/editor_essentials_test.go 和 editor_essentials_visual_test.go,检查持久设置与深色中文、浅色英文。macOS/Windows 原生窗口验收 pending。macOS 使用默认 Command-Shift-A 从编辑器、侧栏及第二个项目窗口打开 Find Action,确认输入聚焦、/ 命令过滤、Return 仅执行一次、Escape 关闭且重新打开无旧查询;弹窗已打开时再次调用应切换到 / 并聚焦。改绑、禁用、恢复及录制时确认菜单与分发使用有效绑定;无工作区或搜索模块不可用时应禁用,激活失败应关闭。IDEA Classic 和 Eclipse 的 Find Action 暂无默认绑定,普通 Search Everywhere 保留双击 Shift 和 Shift-Command-O。macOS 从设置 → 快捷键依次选择 macOS、IntelliJ IDEA Classic、Eclipse,核对运行、调试、查找等操作在界面和实际监听器中的绑定;IDEA Classic 的 Stop Run 应为 Control-F2,Eclipse 的 Resume 应为 F8,继承父 keymap 的命令应使用上游绑定,Find、Replace、GotoImplementation 等显式清空的命令应无绑定;检查分类树初始折叠、全部展开和折叠、分类展开、搜索时自动显示匹配操作、选中行高亮、右侧紧凑键帽及工具栏编辑菜单;通过键帽、工具栏或右键菜单新增、删除与恢复默认,并检查键盘辅助功能;分别修改两套预设的同一命令,切换与重启后确认自定义绑定互不覆盖,并验证旧版单套覆盖迁移到 macOS;按命令名称、ID 和按键搜索,制造冲突并恢复当前预设或应用全部默认;导出再导入 keybindings.json,确认预设与自定义绑定恢复且命令实际执行。Windows 保持现有快捷键编辑、导出和导入验证。",
+ "verification": "新增范围:运行 desktop/internal/settingswindow/editor_essentials_test.go 和 editor_essentials_visual_test.go,检查持久设置与深色中文、浅色英文。macOS/Windows 原生窗口验收 pending。macOS 使用默认 Command-Shift-A 从编辑器、侧栏及第二个项目窗口打开 Find Action,确认输入聚焦、/ 命令过滤、Return 仅执行一次、Escape 关闭且重新打开无旧查询;弹窗已打开时再次调用应切换到 / 并聚焦。改绑、禁用、恢复及录制时确认菜单与分发使用有效绑定;无工作区或搜索模块不可用时应禁用,激活失败应关闭。IDEA Classic 和 Eclipse 的 Find Action 暂无默认绑定,普通 Search Everywhere 保留双击 Shift 和 Shift-Command-O。macOS 从设置 → 快捷键依次选择 macOS、IntelliJ IDEA Classic、Eclipse,核对运行、调试、查找等操作在界面和实际监听器中的绑定;IDEA Classic 的 Stop Run 应为 Control-F2,Eclipse 的 Resume 应为 F8,继承父 keymap 的命令应使用上游绑定,Find、Replace、GotoImplementation 等显式清空的命令应无绑定;检查分类树初始折叠、全部展开和折叠、分类展开、搜索时自动显示匹配操作、选中行高亮、右侧紧凑键帽及工具栏编辑菜单;通过键帽、工具栏或右键菜单新增、删除与恢复默认,并检查键盘辅助功能;分别修改两套预设的同一命令,切换与重启后确认自定义绑定互不覆盖,并验证旧版单套覆盖迁移到 macOS;按命令名称、ID 和按键搜索,制造冲突并恢复当前预设或应用全部默认;导出再导入 keybindings.json,确认预设与自定义绑定恢复且命令实际执行。Windows 保持现有快捷键编辑、导出和导入验证。 运行 TestCloseTabUserBindingClosesTheSelectedEditorTab,先消费旧帧,再新增用户 Control-W 绑定并立即关闭日志页签;测试设置变更必须像真实设置页一样请求刷新,不能依赖后台唤醒。该回归两端都执行,不以 macOS 默认 Command-W 代替用户绑定验证;原生设置窗口验收仍 pending。",
"notes": "Viva:设置 › 快捷键页列出全部动作,可按名称或按键筛选;录制新增组合键、删除单个组合键、单项恢复默认与全部重置,覆盖项存入设置并由 shortcuts 应用到工作台与 Find Action;按键解析由 Core keymap 手势命令完成。keymap_view_test.go 覆盖页面交互;冲突提示与原生窗口验收 pending。 新增命名方案的保存、选择、重命名和删除;Core 保证独立绑定和默认方案保护。页面打开只读取,不自动写入设置。",
"legacy": {
"revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36",
diff --git a/shared/platform-feature-matrix/features/plugin-language-server-sessions.json b/shared/platform-feature-matrix/features/plugin-language-server-sessions.json
index 73c8b87111..2b39d875f0 100644
--- a/shared/platform-feature-matrix/features/plugin-language-server-sessions.json
+++ b/shared/platform-feature-matrix/features/plugin-language-server-sessions.json
@@ -2,7 +2,7 @@
"id": "plugin-language-server-sessions",
"area": "扩展",
"group": "插件与主题",
- "capability": "插件自有语言服务器会话与后端决定启动方式:声明 languageServers 3 的插件,其后端经 lithe/host/languageServer/request|notify|setStatus 向自己的服务器发请求、通知并上报准备状态(preparing/ready/degraded/failed,随进程结束),收到 didChangeState 与 didReceiveNotification;会话策略(请求白名单、门控、串行命令、超时与排队上限、远程不支持)由 Rust Core 执行;serverProcess 3 的 launch.kind:backend 由后端函数在每次启动时给出可执行文件(包内文件或声明的工具)、参数、环境与初始化选项,Core 校验后宿主才启动;documents.contentProvider 让插件为自定义 scheme 提供只读文档(如 jar 内源码);宿主按 state.retention 在后台回收每个工作区的服务器状态目录;状态栏显示插件自己上报的准备状态",
+ "capability": "插件自有语言服务器会话与后端决定启动方式:声明 languageServers 0 的插件,其后端经 lithe/host/languageServer/request|notify|setStatus 向自己的服务器发请求、通知并上报准备状态(preparing/ready/degraded/failed,随进程结束),收到 didChangeState 与 didReceiveNotification;会话策略(请求白名单、门控、串行命令、超时与排队上限、远程不支持)由 Rust Core 执行;launch.kind:backend 由后端函数在每次启动时给出可执行文件(包内文件或声明的工具)、参数、环境与初始化选项,Core 校验后宿主才启动;documents.contentProvider 让插件为自定义 scheme 提供只读文档(如 jar 内源码);宿主按 state.retention 在后台回收每个工作区的服务器状态目录;状态栏显示插件自己上报的准备状态;宿主在 resolveParams.tools 中提供声明工具的所选安装事实,使语言服务器与 Build/Run 使用同一项目工具链;工具入口计划经原生路径校验后复用 Core 的工具模板实例化,保留包入口、运行时参数与工具定义的参数顺序",
"macos": {
"implementationStatus": "partial",
"verificationStatus": "pending",
@@ -11,7 +11,13 @@
"desktop/internal/pluginservice/languagesession.go",
"desktop/internal/pluginservice/hostmethods.go",
"desktop/internal/pluginservice/hostmethods_test.go",
- ".agents/notes/implemented/architecture/2026-11-10-viva-plugin-host-services-and-backend-sessions.md"
+ ".agents/notes/implemented/architecture/2026-11-10-viva-plugin-host-services-and-backend-sessions.md",
+ "desktop/internal/pluginservice/backendlaunch_test.go",
+ "desktop/internal/workbench/java_unmanaged_e2e_test.go",
+ "desktop/internal/pluginbackend/pluginbackend.go",
+ "desktop/internal/pluginbackend/pluginbackend_test.go",
+ "desktop/internal/pluginhost/launch.go",
+ "desktop/internal/pluginhost/launch_test.go"
]
},
"windows": {
@@ -22,12 +28,18 @@
"desktop/internal/pluginservice/languagesession.go",
"desktop/internal/pluginservice/hostmethods.go",
"desktop/internal/pluginservice/hostmethods_test.go",
- ".agents/notes/implemented/architecture/2026-11-10-viva-plugin-host-services-and-backend-sessions.md"
+ ".agents/notes/implemented/architecture/2026-11-10-viva-plugin-host-services-and-backend-sessions.md",
+ "desktop/internal/pluginservice/backendlaunch_test.go",
+ "desktop/internal/workbench/java_unmanaged_e2e_test.go",
+ "desktop/internal/pluginbackend/pluginbackend.go",
+ "desktop/internal/pluginbackend/pluginbackend_test.go",
+ "desktop/internal/pluginhost/launch.go",
+ "desktop/internal/pluginhost/launch_test.go"
]
},
"owner": "Extensions",
- "verification": "共享 Core:cargo test --manifest-path rust/Cargo.toml -p lithe-core,过滤 plugin_server、plugin_function、language_server_sessions、content_providers、declarative,核对 language-server-launch-resolution.json 的启动问题与答案、decodeLaunch 的七类拒绝码、会话策略(白名单、门控、串行、超时、128 个排队后 busy、远程 not_supported)。macOS 宿主:scripts/macos/test/test-macos.sh --filter \"PluginLanguageServerHostServiceTests|PluginBackendLaunchTests|PluginContentProviderTests|MacPluginLanguageServerWorkspaceStateTests\",以及 LitheLanguageIntelligenceModuleTests 中的 PluginLanguageServerRelayTests。scripts/desktop/verify/verify-runtime-bundle-immutability.sh 确认启动后 bundle 内文件清单不变。macOS 原生验收:debug 应用安装一个声明 languageServers 3、serverProcess 3 与 documents.contentProvider 的示例插件(语言服务器用 Metals 或 rust-analyzer 的桩),打开本地工作区后确认后端被调用并返回可执行文件、服务器启动且进程在应用目录之外;后端调用 languageServer/request 得到服务器答案,setStatus 的文字显示在状态栏并随服务器停止消失;关闭窗口后用 pgrep 确认服务器与后端不残留;把一个工作区状态目录的时间改到 40 天前并重新启动,确认它被回收而正在打开的工作区的目录保留;打开远程工作区确认该服务器被拒绝启动。",
- "notes": "Viva 接受 backend 解析的启动(serverProcess 3):先调后端 launch 函数再由 Core 解码启动,状态目录与临时目录不写 app bundle 或安装目录;languageServer/request|notify|setStatus 转发到插件自己的服务器,didReceiveNotification 与 didChangeState 回送后端。{kind: tool} 启动答复尚未接通工具链解析,会被明确拒绝;远程工作区、状态保留清理尚未实现。",
+ "verification": "Viva:scripts/desktop/desktop-go.sh test ./internal/pluginservice -run TestLanguageLaunch -count=1,验证所选安装、可选缺失、项目脚本排除与实际错误传播。显式真实插件集成 TestJavaPluginUnmanagedProjects 验证运行前编译与项目 JVM 一致,需独立插件 ZIP/JDK 输入。两平台另行验证原生窗口中的后端启动、请求/通知、准备状态、只读虚拟文档、关闭项目后的进程释放;远程工作区与状态保留清理未实现,不视为已验收。scripts/desktop/verify/verify-runtime-bundle-immutability.sh 检查资源只读边界。 TestToolEntryUsesCoreInstantiationAfterNativeVerification 读取链接 Core 的非 Java 工具 fixture,验证通用入口模板;TestToolEntryIsVerifiedInsideThePackage 拒绝越界入口。Gradle 的真实设置回读与无中转超时由 TestJavaPluginGradleLegacyReactor 断言。",
+ "notes": "Viva 通过后端函数解析语言服务器启动,Core 校验计划与会话权限,宿主提供所选工具的 executable/home/version,不传环境或凭据,也不把项目脚本当作本地安装。可选工具缺失时保留服务器自己的配置,实际读取失败交给既有启动失败边界。通用逻辑不识别 Java 或其他工具名。远程工作区、状态保留清理及完整原生窗口验收仍有缺口;无头测试不能据此标记全部平台验证完成。",
"legacy": {
"revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36",
"macos": {