mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
The e2e TypeScript project was never type checked: its tsconfig didn't inherit the app's settings, so @/ imports didn't resolve and hundreds of diagnostics went unnoticed. e2e/tsconfig.json now extends the root config (plus Node/Vite types and ES2024), pnpm typecheck runs tsrs -p e2e, and the remaining real type errors in the specs and fixtures are fixed; the code-style docs list the new project. Co-authored-by: Mr0Bread <55754540+Mr0Bread@users.noreply.github.com>
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { EditorView } from "@codemirror/view";
|
|
import type { InlayHint, Range } from "../src/bindings";
|
|
import { commands } from "../src/platform/ipc";
|
|
import { setInvokeRoute } from "../src/platform/tauriCore";
|
|
import { lspDoc } from "../src/editor/lsp/lsp";
|
|
import { inlayExtension } from "../src/editor/lsp/inlay";
|
|
import { lspTheme } from "../src/editor/lsp/theme";
|
|
|
|
const requests: { range: Range; resolve: (hints: InlayHint[]) => void }[] = [];
|
|
setInvokeRoute(() => null);
|
|
commands.lspInlayHints = async (_doc, range) =>
|
|
new Promise((resolve) => requests.push({ range, resolve: (data) => resolve({ status: "ok", data }) }));
|
|
|
|
const view = new EditorView({
|
|
parent: document.body,
|
|
doc: Array.from({ length: 2000 }, (_, i) => `let item${i} = value;`).join("\n"),
|
|
extensions: [
|
|
EditorView.theme({ "&": { height: "400px" }, ".cm-scroller": { overflow: "auto" } }),
|
|
lspTheme,
|
|
lspDoc.of({ doc: 1, path: "demo.rs", language: "rust", uiMode: "Rust", readOnly: false }),
|
|
inlayExtension(),
|
|
],
|
|
});
|
|
|
|
Object.assign(window, {
|
|
inlayTest: {
|
|
count: () => requests.length,
|
|
resolve(index: number) {
|
|
const request = requests[index]!;
|
|
request.resolve([
|
|
{
|
|
position: { line: request.range.start.line + 1, col: 4 },
|
|
label: `hint-${index}`,
|
|
kind: "type",
|
|
paddingLeft: false,
|
|
paddingRight: false,
|
|
tooltip: null,
|
|
parts: [],
|
|
},
|
|
]);
|
|
},
|
|
destroy: () => view.destroy(),
|
|
},
|
|
});
|