From 0c5ac021fc77526dfc7dddb47b1c6ebf7a672584 Mon Sep 17 00:00:00 2001 From: quickbeard Date: Mon, 13 Jul 2026 20:21:49 +0700 Subject: [PATCH 1/2] test(tui): cover hidden LSP sidebar section Export the sidebar LSP View and add a render test asserting the whole section is hidden when config.lsp is disabled, and that the heading, empty state, and connected servers render when enabled. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../tui/src/feature-plugins/sidebar/lsp.tsx | 2 +- .../test/feature-plugins/sidebar-lsp.test.tsx | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 packages/tui/test/feature-plugins/sidebar-lsp.test.tsx diff --git a/packages/tui/src/feature-plugins/sidebar/lsp.tsx b/packages/tui/src/feature-plugins/sidebar/lsp.tsx index a8f977b304..c42e0fcf07 100644 --- a/packages/tui/src/feature-plugins/sidebar/lsp.tsx +++ b/packages/tui/src/feature-plugins/sidebar/lsp.tsx @@ -4,7 +4,7 @@ import { createMemo, For, Show, createSignal } from "solid-js" const id = "internal:sidebar-lsp" -function View(props: { api: TuiPluginApi }) { +export function View(props: { api: TuiPluginApi }) { const [open, setOpen] = createSignal(true) const theme = () => props.api.theme.current const list = createMemo(() => props.api.state.lsp()) diff --git a/packages/tui/test/feature-plugins/sidebar-lsp.test.tsx b/packages/tui/test/feature-plugins/sidebar-lsp.test.tsx new file mode 100644 index 0000000000..c2b3203100 --- /dev/null +++ b/packages/tui/test/feature-plugins/sidebar-lsp.test.tsx @@ -0,0 +1,49 @@ +/** @jsxImportSource @opentui/solid */ +import { expect, test } from "bun:test" +import { testRender } from "@opentui/solid" +import { RGBA } from "@opentui/core" +import type { TuiPluginApi } from "@opencode-ai/plugin/tui" +import { View } from "../../src/feature-plugins/sidebar/lsp" + +function createApi(opts: { + lspEnabled: boolean + servers?: Array<{ id: string; root: string; status: "connected" | "disconnected" }> +}) { + const color = RGBA.fromInts(200, 200, 200) + return { + theme: { current: new Proxy({}, { get: () => color }) }, + state: { + config: { lsp: opts.lspEnabled ? {} : undefined }, + lsp: () => opts.servers ?? [], + }, + } as unknown as TuiPluginApi +} + +async function frame(api: TuiPluginApi) { + const app = await testRender(() => , { width: 40, height: 10 }) + try { + await app.renderOnce() + return app.captureCharFrame() + } finally { + app.renderer.destroy() + } +} + +test("hides the whole LSP section when config.lsp is disabled", async () => { + expect(await frame(createApi({ lspEnabled: false }))).not.toContain("LSP") +}) + +test("renders the LSP heading and empty state when enabled", async () => { + const output = await frame(createApi({ lspEnabled: true })) + expect(output).toContain("LSP") + expect(output).toContain("LSPs will activate as files are read") +}) + +test("lists connected servers when enabled", async () => { + const output = await frame( + createApi({ lspEnabled: true, servers: [{ id: "typescript", root: "/work", status: "connected" }] }), + ) + expect(output).toContain("LSP") + expect(output).toContain("typescript") + expect(output).not.toContain("LSPs will activate") +}) From 930b765512fcb98ed79a29f569edec6bb0147624 Mon Sep 17 00:00:00 2001 From: quickbeard Date: Mon, 13 Jul 2026 20:31:35 +0700 Subject: [PATCH 2/2] chore: re-trigger CI after transient runner outage Co-Authored-By: Claude Opus 4.8 (1M context)