fix(tools): offer an IDE copy only for a tool found on PATH

An executable chosen in settings wins over the IDE's own copy, so its
install button stays a plain Install.
Цей коміт міститься в:
l0ng-ai committed 2026-11-17 19:13:45 +08:00
1 джерело 1d9759dda7
коміт 3fe3088bc8
2 files changed
+30 -3

No files matched your search

+3 -3
Переглянути файл
@@ -435,9 +435,9 @@ function ToolDetails({ tool, language, pending }: { tool: ToolInfo; language: st
? tx("Update")
: tool.status === "installed"
? tx("Reinstall")
: tool.status === "missing"
? tx("Install")
: tx("Install IDE Copy")}
: tool.status === "onPath"
? tx("Install IDE Copy")
: tx("Install")}
</Button>
)}
{tool.canUninstall && (
+27
Переглянути файл
@@ -472,6 +472,33 @@ describe("LanguageServersPage", () => {
expect(screen.queryByRole("button", { name: /^Install Missing/ })).toBeNull();
});
it("offers an IDE copy only for a tool found on PATH", async () => {
backend.tools.push({
...sampleTools().find((t) => t.name === "gopls")!,
name: "golangci-lint-langserver",
displayName: "golangci-lint-langserver",
status: "custom",
path: "/opt/bin/golangci-lint-langserver",
});
const user = userEvent.setup();
renderPage();
await open(user, "TypeScript");
await user.click(toolItem("typescript-language-server"));
const onPath = within(screen.getByLabelText("typescript-language-server details")).getByRole("button", {
name: "Install typescript-language-server",
});
expect(onPath).toHaveTextContent("Install IDE Copy");
expect(onPath).toHaveAttribute("title", expect.stringContaining("/opt/homebrew/bin/typescript-language-server"));
// The executable chosen in settings wins over an IDE copy, so it is a plain Install.
await open(user, "Go");
await user.click(toolItem("golangci-lint-langserver"));
expect(
within(screen.getByLabelText("golangci-lint-langserver details")).getByRole("button", {
name: "Install golangci-lint-langserver",
}),
).toHaveTextContent(/^Install$/);
});
it("notes the other languages a shared tool serves", async () => {
const user = userEvent.setup();
renderPage();