Files
openidea/smoke/desktop.ts
T
l0ng-ai b2d506a929 test(evals): measure Java code intelligence as the user sees it (#2758)
pnpm eval drives the production workbench in Chromium against a release openidea-server and real jdtls, judging each scenario (navigation, usages, implementations, gutter markers, lenses, diagnostics, completion, docs, rename) on time to feedback, first and complete result, and checking results against evals/java/golden/. Supporting changes: data-* hooks in the usages popup, hints and rows; a shared in-page Tauri shim for smoke tests and evals; a shared perf bundle builder; language-server versions in .github/tool-versions.env shared with Language smoke; the eval agent skill.
2026-11-12 12:17:07 +08:00

26 lines
1.0 KiB
TypeScript

/**
* The frontend's view of the desktop app, with a real backend: the window's Tauri runtime
* in-process (`tauriShim.ts`), and every app command sent to an `openidea-server`, as
* remote development sends them.
*/
import { homedir, tmpdir } from "node:os";
import { sep } from "node:path";
import { installTauriShim, type ShimWindow } from "./tauriShim";
import type { Server } from "./server";
installTauriShim({ directories: { 12: tmpdir(), 21: homedir() }, sep: sep as "/" | "\\" });
/** Connects this page's frontend to `server`; returns a function that disconnects it. */
export function connectDesktop(server: Server): () => void {
const w = window as unknown as ShimWindow;
w.__openideaShim.reset();
server.onChannel = (id, data) => w.__openideaShim.channel(id, data);
server.onEvent = (target, event) => w.__openideaShim.event(target, event);
w.__openideaForward = (cmd, args) => server.invoke(cmd, args);
return () => {
delete w.__openideaForward;
server.onChannel = () => {};
server.onEvent = () => {};
};
}