From ab2fbc467446fdcc7cbb95cc6a72db039874ecc2 Mon Sep 17 00:00:00 2001 From: sanchezcarlosjr <24639141+sanchezcarlosjr@users.noreply.github.com> Date: Sun, 19 Nov 2023 07:54:42 -0800 Subject: [PATCH] feat: add for --- src/app/notebook/cellTypes/languages/Cpp.ts | 2 ++ .../notebook/cellTypes/languages/cpp/app.js | 2 +- .../cellTypes/languages/cpp/worker.ts | 33 ------------------- 3 files changed, 3 insertions(+), 34 deletions(-) delete mode 100644 src/app/notebook/cellTypes/languages/cpp/worker.ts diff --git a/src/app/notebook/cellTypes/languages/Cpp.ts b/src/app/notebook/cellTypes/languages/Cpp.ts index ee99c36..a8c0905 100644 --- a/src/app/notebook/cellTypes/languages/Cpp.ts +++ b/src/app/notebook/cellTypes/languages/Cpp.ts @@ -19,6 +19,8 @@ function autocompleteCpp(context: CompletionContext): CompletionResult | null { return 0; }`, detail: "function"}, {label: "int", type: "variable", apply: "int x=0;",detail: "create a int variable"}, + {label: "for", type: "loop", apply: `for(int i=0; i int main() { printf("Hello World"); diff --git a/src/app/notebook/cellTypes/languages/cpp/app.js b/src/app/notebook/cellTypes/languages/cpp/app.js index 2d089cc..a7cc206 100644 --- a/src/app/notebook/cellTypes/languages/cpp/app.js +++ b/src/app/notebook/cellTypes/languages/cpp/app.js @@ -59,7 +59,7 @@ export class App { if (writeStack) { msg = msg + `\n${exn.stack}` } - msg += '\x1b[0m\n' + msg += '' this.memfs.hostWrite(msg) // Propagate error. diff --git a/src/app/notebook/cellTypes/languages/cpp/worker.ts b/src/app/notebook/cellTypes/languages/cpp/worker.ts deleted file mode 100644 index 0100f36..0000000 --- a/src/app/notebook/cellTypes/languages/cpp/worker.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { API } from './api' - -let api: API -let port: MessagePort - -const apiOptions = { - hostWrite(s: string) { - port.postMessage({ id: 'write', data: s }) - }, -} - -let currentApp = null - -const onAnyMessage = async (event) => { - switch (event.data.id) { - case 'constructor': - port = event.data.data - port.onmessage = onAnyMessage - api = new API(apiOptions) - break - - case 'setShowTiming': - api.showTiming = event.data.data - break - - case 'compileLinkRun': - currentApp = await api.compileLinkRun(event.data.data) - console.log(`finished compileLinkRun. currentApp = ${currentApp}.`) - break - } -} - -self.addEventListener('message', onAnyMessage)