mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 16:04:21 +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>
55 lines
1.9 KiB
TypeScript
55 lines
1.9 KiB
TypeScript
import "../src/styles/tokens.css";
|
|
import { EditorView } from "@codemirror/view";
|
|
import { syntaxHighlighting } from "@codemirror/language";
|
|
import { registerLanguageMode } from "../src/editor/api";
|
|
import { openideaHighlightStyle } from "../src/editor/core/cm/highlight";
|
|
import { findLanguageDescription, loadSupport } from "../src/editor/core/cm/languages";
|
|
import { httpLanguageDescription } from "../src/features/http-client/language";
|
|
|
|
const params = new URLSearchParams(location.search);
|
|
document.documentElement.dataset.theme = params.get("theme") ?? "dark";
|
|
document.body.style.backgroundColor = "var(--bg-editor)";
|
|
document.body.style.color = "var(--fg-editor)";
|
|
registerLanguageMode(httpLanguageDescription);
|
|
const file = params.has("rest") ? "requests.rest" : "requests.http";
|
|
const support = await loadSupport(findLanguageDescription("HTTP", file)!);
|
|
const http = document.createElement("div");
|
|
http.id = "http";
|
|
document.body.append(http);
|
|
new EditorView({
|
|
parent: http,
|
|
doc: `### gRPC request with a JSON body
|
|
GRPC localhost:9003/example.Greeter/SayHello
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"name": "World",
|
|
"count": 12,
|
|
"enabled": true,
|
|
"empty": null,
|
|
"items": [1, 2, 3]
|
|
}
|
|
|
|
### WebSocket message
|
|
WEBSOCKET ws://localhost:8080/events
|
|
|
|
{"message": "hello", "ready": false}
|
|
|
|
### Regular HTTP request
|
|
POST https://example.test/messages
|
|
|
|
{"message": "HTTP still works", "count": 1}`,
|
|
extensions: [support!, syntaxHighlighting(openideaHighlightStyle)],
|
|
});
|
|
|
|
const json = document.createElement("div");
|
|
json.id = "json";
|
|
document.body.append(json);
|
|
const jsonSupport = await loadSupport(findLanguageDescription("JSON", "body.json")!);
|
|
if (!jsonSupport) throw new Error("Failed to load JSON support for the highlighting fixture");
|
|
new EditorView({
|
|
parent: json,
|
|
doc: '{"name": "World", "count": 12, "enabled": true, "ready": false, "empty": null, "items": [1]}',
|
|
extensions: [jsonSupport, syntaxHighlighting(openideaHighlightStyle)],
|
|
});
|