From 0ca4ec9d323197b0a55a4e713ab438b930fb3891 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 12 Dec 2023 18:13:48 +0100 Subject: [PATCH] all --- frontend/package-lock.json | 10 +++++++++- frontend/package.json | 4 ++++ frontend/src/lib/components/Editor.svelte | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index c50f80e5c0..846114ce00 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -14,6 +14,7 @@ "@popperjs/core": "^2.11.6", "@redocly/json-to-json-schema": "^0.0.1", "@tanstack/svelte-table": "^8.9.9", + "@typescript/ata": "^0.9.4", "ag-grid-community": "^31.0.0", "ag-grid-enterprise": "^31.0.0", "ansi_up": "^5.2.1", @@ -1618,6 +1619,14 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript/ata": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/@typescript/ata/-/ata-0.9.4.tgz", + "integrity": "sha512-PaJ16WouPV/SaA+c0tnOKIqYq24+m93ipl/e0Dkxuianer+ibc5b0/6ZgfCFF8J7QEp57dySMSP9nWOFaCfJnw==", + "peerDependencies": { + "typescript": "^4.4.4" + } + }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", @@ -9066,7 +9075,6 @@ "version": "5.2.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", - "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/frontend/package.json b/frontend/package.json index 7fd565fc0b..a322619562 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -71,6 +71,9 @@ "yootils": "^0.3.1" }, "overrides": { + "@typescript/ata": { + "typescript": "$typescript" + }, "@rgossiaux/svelte-headlessui": { "svelte": "$svelte" }, @@ -97,6 +100,7 @@ "@popperjs/core": "^2.11.6", "@redocly/json-to-json-schema": "^0.0.1", "@tanstack/svelte-table": "^8.9.9", + "@typescript/ata": "^0.9.4", "ag-grid-community": "^31.0.0", "ag-grid-enterprise": "^31.0.0", "ansi_up": "^5.2.1", diff --git a/frontend/src/lib/components/Editor.svelte b/frontend/src/lib/components/Editor.svelte index 64b89f40ce..08d97bbfbc 100644 --- a/frontend/src/lib/components/Editor.svelte +++ b/frontend/src/lib/components/Editor.svelte @@ -33,6 +33,7 @@ import { CloseAction, ErrorAction, RequestType, NotificationType } from 'vscode-languageclient' import { MonacoBinding } from 'y-monaco' import { dbSchemas, type DBSchema, copilotInfo, codeCompletionSessionEnabled } from '$lib/stores' + import { setupTypeAcquisition } from '@typescript/ata' import { createHash as randomHash, @@ -747,6 +748,23 @@ } ) } else if (lang === 'typescript' && scriptLang !== 'deno') { + ata = setupTypeAcquisition({ + projectName: 'TypeScript Playground', + typescript: ts, + logger: console, + delegate: { + receivedFile: addLibraryToRuntime, + progress: (downloaded: number, total: number) => { + // console.log({ dl, ttl }) + }, + started: () => { + console.log('ATA start') + }, + finished: (f) => { + console.log('ATA done') + } + } + }) await connectToLanguageServer( `${wsProtocol}://${window.location.host}/ws/bun`, 'bun',