wasm-idle 0.7.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +760 -81
- package/dist/index.d.ts +4 -9
- package/dist/index.js +2 -4
- package/dist/playground/applicationAssets.d.ts +4 -0
- package/dist/playground/applicationAssets.js +277 -0
- package/dist/playground/assemblyscript.d.ts +41 -0
- package/dist/playground/assemblyscript.js +630 -0
- package/dist/playground/assetBridge.d.ts +18 -7
- package/dist/playground/assetBridge.js +824 -100
- package/dist/playground/assets.d.ts +813 -19
- package/dist/playground/assets.js +2096 -156
- package/dist/playground/awk.d.ts +5 -0
- package/dist/playground/awk.js +60 -0
- package/dist/playground/bash.d.ts +53 -0
- package/dist/playground/bash.js +1096 -0
- package/dist/playground/bashWorkerProtocol.d.ts +88 -0
- package/dist/playground/bashWorkerProtocol.js +135 -0
- package/dist/playground/bqn.d.ts +5 -0
- package/dist/playground/bqn.js +57 -0
- package/dist/playground/bqnPreflight.d.ts +26 -0
- package/dist/playground/bqnPreflight.js +399 -0
- package/dist/playground/c3.d.ts +15 -0
- package/dist/playground/c3.js +154 -0
- package/dist/playground/clang.d.ts +35 -19
- package/dist/playground/clang.js +241 -52
- package/dist/playground/clangAssetIntegrity.d.ts +32 -0
- package/dist/playground/clangAssetIntegrity.js +8 -0
- package/dist/playground/clojurescript.d.ts +5 -0
- package/dist/playground/clojurescript.js +59 -0
- package/dist/playground/clojurescriptPreflight.d.ts +26 -0
- package/dist/playground/clojurescriptPreflight.js +383 -0
- package/dist/playground/cobol.d.ts +46 -0
- package/dist/playground/cobol.js +703 -0
- package/dist/playground/d.d.ts +47 -0
- package/dist/playground/d.js +644 -0
- package/dist/playground/dOuterAssets.d.ts +16 -0
- package/dist/playground/dOuterAssets.js +163 -0
- package/dist/playground/dotnet.d.ts +99 -0
- package/dist/playground/dotnet.js +1131 -0
- package/dist/playground/duckdb.d.ts +36 -0
- package/dist/playground/duckdb.js +542 -0
- package/dist/playground/elixir.d.ts +18 -10
- package/dist/playground/elixir.js +630 -96
- package/dist/playground/elixirAssets.d.ts +6 -0
- package/dist/playground/elixirAssets.js +33 -0
- package/dist/playground/executionObservation.d.ts +22 -0
- package/dist/playground/executionObservation.js +65 -0
- package/dist/playground/forth.d.ts +5 -0
- package/dist/playground/forth.js +53 -0
- package/dist/playground/forthPreflight.d.ts +24 -0
- package/dist/playground/forthPreflight.js +198 -0
- package/dist/playground/fortran.d.ts +47 -0
- package/dist/playground/fortran.js +651 -0
- package/dist/playground/fortranAssets.d.ts +6 -0
- package/dist/playground/fortranAssets.js +27 -0
- package/dist/playground/gleam.d.ts +6 -0
- package/dist/playground/gleam.js +33 -0
- package/dist/playground/go.d.ts +17 -11
- package/dist/playground/go.js +376 -72
- package/dist/playground/goDebugInstrumentation.d.ts +1 -0
- package/dist/playground/goDebugInstrumentation.js +229 -0
- package/dist/playground/haskell.d.ts +44 -0
- package/dist/playground/haskell.js +678 -0
- package/dist/playground/haskellAssets.d.ts +24 -0
- package/dist/playground/haskellAssets.js +93 -0
- package/dist/playground/index.d.ts +1 -1
- package/dist/playground/index.js +360 -111
- package/dist/playground/j.d.ts +5 -0
- package/dist/playground/j.js +60 -0
- package/dist/playground/jPreflight.d.ts +26 -0
- package/dist/playground/jPreflight.js +372 -0
- package/dist/playground/janet.d.ts +5 -0
- package/dist/playground/janet.js +64 -0
- package/dist/playground/java.d.ts +24 -10
- package/dist/playground/java.js +706 -84
- package/dist/playground/javaSource.d.ts +5 -0
- package/dist/playground/javaSource.js +16 -0
- package/dist/playground/javaStdin.d.ts +1 -1
- package/dist/playground/javaStdin.js +13 -4
- package/dist/playground/julia.d.ts +5 -0
- package/dist/playground/julia.js +64 -0
- package/dist/playground/lfortran.d.ts +8 -0
- package/dist/playground/lfortran.js +30 -0
- package/dist/playground/lfortranAssets.d.ts +21 -0
- package/dist/playground/lfortranAssets.js +118 -0
- package/dist/playground/lisp.d.ts +45 -0
- package/dist/playground/lisp.js +640 -0
- package/dist/playground/lispAssets.d.ts +9 -0
- package/dist/playground/lispAssets.js +74 -0
- package/dist/playground/lldbManifest.d.ts +3 -0
- package/dist/playground/lldbManifest.js +155 -0
- package/dist/playground/lldbSession.d.ts +115 -0
- package/dist/playground/lldbSession.js +1347 -0
- package/dist/playground/loadingProgress.d.ts +16 -0
- package/dist/playground/loadingProgress.js +166 -0
- package/dist/playground/lua.d.ts +44 -0
- package/dist/playground/lua.js +630 -0
- package/dist/playground/nim.d.ts +5 -0
- package/dist/playground/nim.js +76 -0
- package/dist/playground/objectivec.d.ts +39 -0
- package/dist/playground/objectivec.js +288 -0
- package/dist/playground/ocaml.d.ts +28 -10
- package/dist/playground/ocaml.js +815 -253
- package/dist/playground/octave.d.ts +43 -0
- package/dist/playground/octave.js +783 -0
- package/dist/playground/options.d.ts +19 -40
- package/dist/playground/options.js +2 -1
- package/dist/playground/pascal.d.ts +5 -0
- package/dist/playground/pascal.js +60 -0
- package/dist/playground/perl.d.ts +5 -0
- package/dist/playground/perl.js +61 -0
- package/dist/playground/php.d.ts +44 -0
- package/dist/playground/php.js +665 -0
- package/dist/playground/prolog.d.ts +6 -0
- package/dist/playground/prolog.js +75 -0
- package/dist/playground/python.d.ts +20 -14
- package/dist/playground/python.js +445 -101
- package/dist/playground/pythonPackageLock.d.ts +6 -0
- package/dist/playground/pythonPackageLock.js +56 -0
- package/dist/playground/r.d.ts +44 -0
- package/dist/playground/r.js +637 -0
- package/dist/playground/ruby.d.ts +46 -0
- package/dist/playground/ruby.js +732 -0
- package/dist/playground/rubyAssets.d.ts +23 -0
- package/dist/playground/rubyAssets.js +68 -0
- package/dist/playground/rubyTestPreflight.d.ts +2 -0
- package/dist/playground/rubyTestPreflight.js +18 -0
- package/dist/playground/runtimeModule.d.ts +1 -0
- package/dist/playground/runtimeModule.js +5 -0
- package/dist/playground/rust.d.ts +44 -13
- package/dist/playground/rust.js +714 -76
- package/dist/playground/rustExecutableGraph.d.ts +85 -0
- package/dist/playground/rustExecutableGraph.js +946 -0
- package/dist/playground/rustWorkerLimits.d.ts +17 -0
- package/dist/playground/rustWorkerLimits.js +34 -0
- package/dist/playground/sandbox.d.ts +16 -10
- package/dist/playground/sharedBuffer.d.ts +6 -0
- package/dist/playground/sharedBuffer.js +12 -0
- package/dist/playground/sqlite.d.ts +38 -0
- package/dist/playground/sqlite.js +550 -0
- package/dist/playground/staticRuntimeModuleVersion.d.ts +1 -0
- package/dist/playground/staticRuntimeModuleVersion.js +2 -0
- package/dist/playground/staticRuntimePreflight.d.ts +13 -0
- package/dist/playground/staticRuntimePreflight.js +231 -0
- package/dist/playground/staticRuntimePreflightExecute.d.ts +8 -0
- package/dist/playground/staticRuntimePreflightExecute.js +66 -0
- package/dist/playground/staticRuntimePreflightProtocol.d.ts +68 -0
- package/dist/playground/staticRuntimePreflightProtocol.js +339 -0
- package/dist/playground/staticStdinRing.d.ts +45 -0
- package/dist/playground/staticStdinRing.js +158 -0
- package/dist/playground/staticWorkerRuntime.d.ts +154 -0
- package/dist/playground/staticWorkerRuntime.js +1917 -0
- package/dist/playground/stdinBuffer.d.ts +9 -7
- package/dist/playground/stdinBuffer.js +9 -18
- package/dist/playground/swift.d.ts +5 -0
- package/dist/playground/swift.js +17 -0
- package/dist/playground/tcl.d.ts +5 -0
- package/dist/playground/tcl.js +62 -0
- package/dist/playground/teavmConfig.d.ts +1 -1
- package/dist/playground/teavmConfig.js +2 -2
- package/dist/playground/tinygo.d.ts +48 -18
- package/dist/playground/tinygo.js +1202 -329
- package/dist/playground/tinygoExecutableGraph.d.ts +44 -0
- package/dist/playground/tinygoExecutableGraph.js +449 -0
- package/dist/playground/typescript.d.ts +55 -0
- package/dist/playground/typescript.js +924 -0
- package/dist/playground/wasm.d.ts +43 -0
- package/dist/playground/wasm.js +608 -0
- package/dist/playground/wasmAwkVersion.d.ts +59 -0
- package/dist/playground/wasmAwkVersion.js +31 -0
- package/dist/playground/wasmBashVersion.d.ts +63 -0
- package/dist/playground/wasmBashVersion.js +36 -0
- package/dist/playground/wasmBqnVersion.d.ts +24 -0
- package/dist/playground/wasmBqnVersion.js +24 -0
- package/dist/playground/wasmC3Version.d.ts +20 -0
- package/dist/playground/wasmC3Version.js +21 -0
- package/dist/playground/wasmClojureScriptVersion.d.ts +21 -0
- package/dist/playground/wasmClojureScriptVersion.js +21 -0
- package/dist/playground/wasmDIntegrity.d.ts +15 -0
- package/dist/playground/wasmDIntegrity.js +15 -0
- package/dist/playground/wasmDVersion.d.ts +1 -0
- package/dist/playground/wasmDVersion.js +1 -0
- package/dist/playground/wasmDebugVersion.d.ts +6 -0
- package/dist/playground/wasmDebugVersion.js +6 -0
- package/dist/playground/wasmDotnetVersion.d.ts +1 -0
- package/dist/playground/wasmDotnetVersion.js +1 -0
- package/dist/playground/wasmElixirVersion.d.ts +21 -1
- package/dist/playground/wasmElixirVersion.js +21 -1
- package/dist/playground/wasmForthVersion.d.ts +18 -0
- package/dist/playground/wasmForthVersion.js +18 -0
- package/dist/playground/wasmFortranExecutionAssets.d.ts +15 -0
- package/dist/playground/wasmFortranExecutionAssets.js +15 -0
- package/dist/playground/wasmFortranVersion.d.ts +1 -0
- package/dist/playground/wasmFortranVersion.js +1 -0
- package/dist/playground/wasmGleamVersion.d.ts +5 -0
- package/dist/playground/wasmGleamVersion.js +5 -0
- package/dist/playground/wasmGoVersion.d.ts +1 -1
- package/dist/playground/wasmGoVersion.js +1 -1
- package/dist/playground/wasmHaskellVersion.d.ts +1 -0
- package/dist/playground/wasmHaskellVersion.js +1 -0
- package/dist/playground/wasmJVersion.d.ts +24 -0
- package/dist/playground/wasmJVersion.js +24 -0
- package/dist/playground/wasmJanetVersion.d.ts +53 -0
- package/dist/playground/wasmJanetVersion.js +30 -0
- package/dist/playground/wasmJuliaVersion.d.ts +71 -0
- package/dist/playground/wasmJuliaVersion.js +39 -0
- package/dist/playground/wasmLfortranVersion.d.ts +28 -0
- package/dist/playground/wasmLfortranVersion.js +29 -0
- package/dist/playground/wasmLispVersion.d.ts +1 -0
- package/dist/playground/wasmLispVersion.js +1 -0
- package/dist/playground/wasmLuaVersion.d.ts +1 -0
- package/dist/playground/wasmLuaVersion.js +1 -0
- package/dist/playground/wasmNimVersion.d.ts +125 -0
- package/dist/playground/wasmNimVersion.js +66 -0
- package/dist/playground/wasmObjectiveCVersion.d.ts +27 -0
- package/dist/playground/wasmObjectiveCVersion.js +27 -0
- package/dist/playground/wasmOcamlVersion.d.ts +12 -1
- package/dist/playground/wasmOcamlVersion.js +12 -1
- package/dist/playground/wasmOctaveVersion.d.ts +1 -0
- package/dist/playground/wasmOctaveVersion.js +1 -0
- package/dist/playground/wasmPascalVersion.d.ts +61 -0
- package/dist/playground/wasmPascalVersion.js +34 -0
- package/dist/playground/wasmPerlVersion.d.ts +71 -0
- package/dist/playground/wasmPerlVersion.js +39 -0
- package/dist/playground/wasmPrologVersion.d.ts +31 -0
- package/dist/playground/wasmPrologVersion.js +31 -0
- package/dist/playground/wasmRVersion.d.ts +1 -0
- package/dist/playground/wasmRVersion.js +1 -0
- package/dist/playground/wasmRustVersion.d.ts +1306 -1
- package/dist/playground/wasmRustVersion.js +1458 -1
- package/dist/playground/wasmSwiftVersion.d.ts +1 -0
- package/dist/playground/wasmSwiftVersion.js +1 -0
- package/dist/playground/wasmTclVersion.d.ts +85 -0
- package/dist/playground/wasmTclVersion.js +46 -0
- package/dist/playground/wasmTinyGoVersion.d.ts +98 -1
- package/dist/playground/wasmTinyGoVersion.js +107 -1
- package/dist/playground/wasmTypeScriptVersion.d.ts +5 -0
- package/dist/playground/wasmTypeScriptVersion.js +5 -0
- package/dist/playground/wasmWatVersion.d.ts +1 -0
- package/dist/playground/wasmWatVersion.js +1 -0
- package/dist/playground/wasmZigVersion.d.ts +13 -0
- package/dist/playground/wasmZigVersion.js +13 -0
- package/dist/playground/wat.d.ts +44 -0
- package/dist/playground/wat.js +622 -0
- package/dist/playground/worker/assemblyscript.js +339 -0
- package/dist/playground/worker/assets.d.ts +7 -0
- package/dist/playground/worker/assets.js +288 -39
- package/dist/playground/worker/bash.js +338 -0
- package/dist/playground/worker/bashNestedBootstrap.d.ts +6 -0
- package/dist/playground/worker/bashNestedBootstrap.js +59 -0
- package/dist/playground/worker/bashRuntime.d.ts +89 -0
- package/dist/playground/worker/bashRuntime.js +982 -0
- package/dist/playground/worker/clang.js +92 -13
- package/dist/playground/worker/cobol.js +107 -0
- package/dist/playground/worker/d.js +199 -0
- package/dist/playground/worker/dotnet.js +141 -0
- package/dist/playground/worker/duckdb.d.ts +1 -0
- package/dist/playground/worker/duckdb.js +136 -0
- package/dist/playground/worker/elixir.js +307 -41
- package/dist/playground/worker/fortran.d.ts +1 -0
- package/dist/playground/worker/fortran.js +295 -0
- package/dist/playground/worker/go.js +246 -40
- package/dist/playground/worker/haskell.d.ts +7 -0
- package/dist/playground/worker/haskell.js +465 -0
- package/dist/playground/worker/java.js +59 -20
- package/dist/playground/worker/lisp.d.ts +1 -0
- package/dist/playground/worker/lisp.js +195 -0
- package/dist/playground/worker/lua.d.ts +1 -0
- package/dist/playground/worker/lua.js +163 -0
- package/dist/playground/worker/objectivec.d.ts +1 -0
- package/dist/playground/worker/objectivec.js +10 -0
- package/dist/playground/worker/ocaml.js +206 -58
- package/dist/playground/worker/php.d.ts +1 -0
- package/dist/playground/worker/php.js +261 -0
- package/dist/playground/worker/python.js +201 -44
- package/dist/playground/worker/r.d.ts +1 -0
- package/dist/playground/worker/r.js +192 -0
- package/dist/playground/worker/ruby.d.ts +1 -0
- package/dist/playground/worker/ruby.js +248 -0
- package/dist/playground/worker/runtimeAssetFetch.d.ts +15 -0
- package/dist/playground/worker/runtimeAssetFetch.js +375 -0
- package/dist/playground/worker/rust.js +546 -20
- package/dist/playground/worker/sqlite.d.ts +1 -0
- package/dist/playground/worker/sqlite.js +112 -0
- package/dist/playground/worker/staticRuntimePreflight.d.ts +1 -0
- package/dist/playground/worker/staticRuntimePreflight.js +56 -0
- package/dist/playground/worker/tinygo.js +34 -9
- package/dist/playground/worker/typescript.d.ts +1 -0
- package/dist/playground/worker/typescript.js +251 -0
- package/dist/playground/worker/wasm.d.ts +1 -0
- package/dist/playground/worker/wasm.js +273 -0
- package/dist/playground/worker/wat.d.ts +1 -0
- package/dist/playground/worker/wat.js +188 -0
- package/dist/playground/worker/zig.d.ts +8 -0
- package/dist/playground/worker/zig.js +578 -0
- package/dist/playground/workerProgress.d.ts +15 -0
- package/dist/playground/workerProgress.js +72 -0
- package/dist/playground/workerSession.d.ts +28 -0
- package/dist/playground/workerSession.js +164 -0
- package/dist/playground/zig.d.ts +46 -0
- package/dist/playground/zig.js +690 -0
- package/dist/playground/zigAssets.d.ts +6 -0
- package/dist/playground/zigAssets.js +49 -0
- package/package.json +234 -105
- package/dist/clang/app.d.ts +0 -75
- package/dist/clang/app.js +0 -744
- package/dist/clang/apply.d.ts +0 -2
- package/dist/clang/apply.js +0 -11
- package/dist/clang/color.d.ts +0 -3
- package/dist/clang/color.js +0 -3
- package/dist/clang/encode.d.ts +0 -4
- package/dist/clang/encode.js +0 -20
- package/dist/clang/error.d.ts +0 -14
- package/dist/clang/error.js +0 -27
- package/dist/clang/gccCompat.d.ts +0 -15
- package/dist/clang/gccCompat.js +0 -767
- package/dist/clang/index.d.ts +0 -85
- package/dist/clang/index.js +0 -1077
- package/dist/clang/memory/index.d.ts +0 -4
- package/dist/clang/memory/index.js +0 -4
- package/dist/clang/memory/memFs.d.ts +0 -35
- package/dist/clang/memory/memFs.js +0 -132
- package/dist/clang/memory/memory.d.ts +0 -22
- package/dist/clang/memory/memory.js +0 -73
- package/dist/clang/memory/tar.d.ts +0 -2
- package/dist/clang/memory/tar.js +0 -59
- package/dist/clang/url.d.ts +0 -4
- package/dist/clang/url.js +0 -5
- package/dist/clang/wasm.d.ts +0 -4
- package/dist/clang/wasm.js +0 -50
- package/dist/clangd/config.d.ts +0 -18
- package/dist/clangd/config.js +0 -14
- package/dist/clangd/jsonStream.d.ts +0 -9
- package/dist/clangd/jsonStream.js +0 -48
- package/dist/clangd/session.d.ts +0 -18
- package/dist/clangd/session.js +0 -112
- package/dist/clangd/worker.js +0 -131
- package/dist/debug/controller.svelte.d.ts +0 -43
- package/dist/debug/controller.svelte.js +0 -268
- package/dist/debug/editor/index.d.ts +0 -2
- package/dist/debug/editor/index.js +0 -1
- package/dist/debug/editor/monaco.d.ts +0 -26
- package/dist/debug/editor/monaco.js +0 -128
- package/dist/debug/expression.d.ts +0 -26
- package/dist/debug/expression.js +0 -547
- package/dist/debug/index.d.ts +0 -8
- package/dist/debug/index.js +0 -5
- package/dist/debug/language/cpp.d.ts +0 -2
- package/dist/debug/language/cpp.js +0 -7
- package/dist/debug/language/index.d.ts +0 -3
- package/dist/debug/language/index.js +0 -2
- package/dist/debug/language/python.d.ts +0 -2
- package/dist/debug/language/python.js +0 -14
- package/dist/debug/language/types.d.ts +0 -6
- package/dist/debug/locals.d.ts +0 -2
- package/dist/debug/locals.js +0 -8
- package/dist/lsp/cpp/server.d.ts +0 -2
- package/dist/lsp/cpp/server.js +0 -68
- package/dist/lsp/index.d.ts +0 -5
- package/dist/lsp/index.js +0 -4
- package/dist/lsp/python/main.worker.js +0 -92
- package/dist/lsp/python/package/arcturus_python_lsp/__init__.py +0 -3
- package/dist/lsp/python/package/arcturus_python_lsp/server.py +0 -462
- package/dist/lsp/python/server.d.ts +0 -2
- package/dist/lsp/python/server.js +0 -54
- package/dist/lsp/registry.d.ts +0 -2
- package/dist/lsp/registry.js +0 -12
- package/dist/lsp/runtime.d.ts +0 -5
- package/dist/lsp/runtime.js +0 -31
- package/dist/lsp/types.d.ts +0 -17
- package/dist/terminal/Terminal.svelte +0 -422
- package/dist/terminal/Terminal.svelte.d.ts +0 -26
- package/dist/terminal/index.d.ts +0 -7
- package/dist/terminal/index.js +0 -5
- package/dist/terminal/plugin/index.d.ts +0 -9
- package/dist/terminal/plugin/index.js +0 -19
- package/dist/terminal/theme.d.ts +0 -49
- package/dist/terminal/theme.js +0 -49
- package/dist/terminal/types.d.ts +0 -18
- package/dist/utils/vscodeJsonrpcBrowser.d.ts +0 -5
- package/dist/utils/vscodeJsonrpcBrowser.js +0 -4
- /package/dist/{clangd/worker.d.ts → playground/worker/assemblyscript.d.ts} +0 -0
- /package/dist/{debug/language/types.js → playground/worker/bash.d.ts} +0 -0
- /package/dist/{lsp/python/main.worker.d.ts → playground/worker/cobol.d.ts} +0 -0
- /package/dist/{lsp/types.js → playground/worker/d.d.ts} +0 -0
- /package/dist/{terminal/types.js → playground/worker/dotnet.d.ts} +0 -0
package/dist/clangd/worker.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/// <reference lib="WebWorker" />
|
|
2
|
-
import { CLANGD_CPP_FILE_PATH, CLANGD_WORKSPACE_PATH, createClangdCompileFlags, normalizeClangdBaseUrl } from './config';
|
|
3
|
-
import { writeGccCompatibilityHeaders } from '../clang/gccCompat';
|
|
4
|
-
import { JsonStream } from './jsonStream';
|
|
5
|
-
import { configureWorkerRuntimeAssets, handleWorkerAssetMessage, loadWorkerRuntimeAsset } from '../playground/worker/assets';
|
|
6
|
-
import { BrowserMessageReader, BrowserMessageWriter } from '../utils/vscodeJsonrpcBrowser';
|
|
7
|
-
const textEncoder = new TextEncoder();
|
|
8
|
-
const jsonStream = new JsonStream();
|
|
9
|
-
let resolveStdinReady = () => { };
|
|
10
|
-
const stdinChunks = [];
|
|
11
|
-
const currentStdinChunk = [];
|
|
12
|
-
const stdin = () => {
|
|
13
|
-
if (currentStdinChunk.length === 0) {
|
|
14
|
-
if (stdinChunks.length === 0)
|
|
15
|
-
return null;
|
|
16
|
-
const nextChunk = stdinChunks.shift();
|
|
17
|
-
if (!nextChunk)
|
|
18
|
-
return null;
|
|
19
|
-
currentStdinChunk.push(...textEncoder.encode(nextChunk), null);
|
|
20
|
-
}
|
|
21
|
-
return currentStdinChunk.shift() ?? null;
|
|
22
|
-
};
|
|
23
|
-
const stdinReady = async () => {
|
|
24
|
-
if (stdinChunks.length === 0) {
|
|
25
|
-
return new Promise((resolve) => {
|
|
26
|
-
resolveStdinReady = resolve;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
let writer = null;
|
|
31
|
-
let clangdRuntime = null;
|
|
32
|
-
const stdout = (charCode) => {
|
|
33
|
-
const json = jsonStream.insert(charCode);
|
|
34
|
-
if (json && writer)
|
|
35
|
-
writer.write(JSON.parse(json));
|
|
36
|
-
};
|
|
37
|
-
const stderr = () => { };
|
|
38
|
-
const onAbort = () => {
|
|
39
|
-
writer?.end();
|
|
40
|
-
self.reportError?.('clangd aborted');
|
|
41
|
-
};
|
|
42
|
-
const syncWorkspaceFile = (filePath) => {
|
|
43
|
-
if (!clangdRuntime)
|
|
44
|
-
return;
|
|
45
|
-
const normalizedFilePath = filePath.startsWith(CLANGD_WORKSPACE_PATH)
|
|
46
|
-
? filePath
|
|
47
|
-
: `${CLANGD_WORKSPACE_PATH}/${filePath.replace(/^\/+/, '')}`;
|
|
48
|
-
const lastSlash = normalizedFilePath.lastIndexOf('/');
|
|
49
|
-
const directoryPath = lastSlash > 0 ? normalizedFilePath.slice(0, lastSlash) : CLANGD_WORKSPACE_PATH;
|
|
50
|
-
clangdRuntime.FS.mkdirTree(directoryPath);
|
|
51
|
-
clangdRuntime.FS.writeFile(normalizedFilePath, '');
|
|
52
|
-
};
|
|
53
|
-
self.addEventListener('message', async (event) => {
|
|
54
|
-
if (handleWorkerAssetMessage(event.data))
|
|
55
|
-
return;
|
|
56
|
-
if (event.data?.type === 'sync-file' && typeof event.data?.name === 'string') {
|
|
57
|
-
syncWorkspaceFile(event.data.name);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (event.data?.type !== 'init')
|
|
61
|
-
return;
|
|
62
|
-
const runtimeAssets = event.data.assets;
|
|
63
|
-
const normalizedBaseUrl = normalizeClangdBaseUrl(event.data.baseUrl || '');
|
|
64
|
-
const baseUrl = runtimeAssets?.baseUrl || (normalizedBaseUrl ? `${normalizedBaseUrl}/` : '/clangd/');
|
|
65
|
-
configureWorkerRuntimeAssets({
|
|
66
|
-
baseUrl,
|
|
67
|
-
useAssetBridge: !!runtimeAssets?.useAssetBridge
|
|
68
|
-
});
|
|
69
|
-
try {
|
|
70
|
-
const jsSource = new TextDecoder().decode((await loadWorkerRuntimeAsset('clangd.js')).bytes);
|
|
71
|
-
self.postMessage({ type: 'progress', value: 1, max: 3 });
|
|
72
|
-
const jsDataUrl = URL.createObjectURL(new Blob([jsSource], { type: 'text/javascript;charset=utf-8' }));
|
|
73
|
-
const jsModule = import(/* @vite-ignore */ jsDataUrl);
|
|
74
|
-
const compressedWasmBytes = (await loadWorkerRuntimeAsset('clangd.wasm.gz')).bytes;
|
|
75
|
-
self.postMessage({ type: 'progress', value: 2, max: 3 });
|
|
76
|
-
let wasmBytes = compressedWasmBytes;
|
|
77
|
-
if (compressedWasmBytes[0] === 0x1f && compressedWasmBytes[1] === 0x8b) {
|
|
78
|
-
if (typeof DecompressionStream === 'undefined') {
|
|
79
|
-
throw new Error('Failed to decompress clangd.wasm.gz: DecompressionStream is unavailable');
|
|
80
|
-
}
|
|
81
|
-
const compressedWasmCopy = new Uint8Array(compressedWasmBytes.byteLength);
|
|
82
|
-
compressedWasmCopy.set(compressedWasmBytes);
|
|
83
|
-
const stream = new Blob([compressedWasmCopy.buffer])
|
|
84
|
-
.stream()
|
|
85
|
-
.pipeThrough(new DecompressionStream('gzip'));
|
|
86
|
-
wasmBytes = new Uint8Array(await new Response(stream).arrayBuffer());
|
|
87
|
-
}
|
|
88
|
-
self.postMessage({ type: 'progress', value: 3, max: 3 });
|
|
89
|
-
const wasmBlobBytes = new Uint8Array(wasmBytes.byteLength);
|
|
90
|
-
wasmBlobBytes.set(wasmBytes);
|
|
91
|
-
const wasmBlob = new Blob([wasmBlobBytes.buffer], { type: 'application/wasm' });
|
|
92
|
-
const wasmDataUrl = URL.createObjectURL(wasmBlob);
|
|
93
|
-
const { default: Clangd } = await jsModule;
|
|
94
|
-
clangdRuntime = await Clangd({
|
|
95
|
-
thisProgram: '/usr/bin/clangd',
|
|
96
|
-
mainScriptUrlOrBlob: jsDataUrl,
|
|
97
|
-
locateFile: (path, prefix) => path.endsWith('.wasm') ? wasmDataUrl : `${prefix}${path}`,
|
|
98
|
-
stdinReady,
|
|
99
|
-
stdin,
|
|
100
|
-
stdout,
|
|
101
|
-
stderr,
|
|
102
|
-
onExit: onAbort,
|
|
103
|
-
onAbort
|
|
104
|
-
});
|
|
105
|
-
clangdRuntime.FS.mkdirTree(CLANGD_WORKSPACE_PATH);
|
|
106
|
-
writeGccCompatibilityHeaders(clangdRuntime.FS, '/usr');
|
|
107
|
-
syncWorkspaceFile(CLANGD_CPP_FILE_PATH);
|
|
108
|
-
clangdRuntime.FS.writeFile(`${CLANGD_WORKSPACE_PATH}/.clangd`, JSON.stringify({
|
|
109
|
-
CompileFlags: {
|
|
110
|
-
Add: createClangdCompileFlags()
|
|
111
|
-
}
|
|
112
|
-
}));
|
|
113
|
-
clangdRuntime.callMain([]);
|
|
114
|
-
writer = new BrowserMessageWriter(self);
|
|
115
|
-
const reader = new BrowserMessageReader(self);
|
|
116
|
-
reader.listen((data) => {
|
|
117
|
-
const body = JSON.stringify(data).replace(/[\u007F-\uFFFF]/g, (character) => {
|
|
118
|
-
return '\\u' + character.codePointAt(0)?.toString(16).padStart(4, '0');
|
|
119
|
-
});
|
|
120
|
-
stdinChunks.push(`Content-Length: ${body.length}\r\n`, '\r\n', body);
|
|
121
|
-
resolveStdinReady();
|
|
122
|
-
});
|
|
123
|
-
self.postMessage({ type: 'ready', value: wasmBytes.byteLength });
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
self.postMessage({
|
|
127
|
-
type: 'error',
|
|
128
|
-
message: error instanceof Error ? error.message : String(error)
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { DebugLanguageAdapter } from './language';
|
|
2
|
-
import type { DebugCommand, DebugFrame, DebugSessionEvent, DebugVariable } from '../playground/options';
|
|
3
|
-
import type { TerminalControl } from '../terminal';
|
|
4
|
-
export type DebugWatchValue = {
|
|
5
|
-
expression: string;
|
|
6
|
-
value: string;
|
|
7
|
-
};
|
|
8
|
-
export type DebugSessionControllerOptions = {
|
|
9
|
-
terminal?: TerminalControl;
|
|
10
|
-
adapter?: DebugLanguageAdapter | null;
|
|
11
|
-
breakpoints?: number[];
|
|
12
|
-
cursorLine?: number | null;
|
|
13
|
-
syncBreakpointsWhile?: boolean | (() => boolean);
|
|
14
|
-
};
|
|
15
|
-
export declare function createDebugSessionController(options?: DebugSessionControllerOptions): {
|
|
16
|
-
readonly active: boolean;
|
|
17
|
-
readonly paused: boolean;
|
|
18
|
-
readonly pausedLine: number | null;
|
|
19
|
-
readonly locals: DebugVariable[];
|
|
20
|
-
readonly callStack: DebugFrame[];
|
|
21
|
-
readonly runToCursorLine: number | null;
|
|
22
|
-
readonly breakpoints: number[];
|
|
23
|
-
readonly effectiveBreakpoints: number[];
|
|
24
|
-
readonly cursorLine: number | null;
|
|
25
|
-
readonly canRunToCursor: boolean;
|
|
26
|
-
watchInput: string;
|
|
27
|
-
readonly watchExpressions: string[];
|
|
28
|
-
readonly watchValues: DebugWatchValue[];
|
|
29
|
-
begin: () => void;
|
|
30
|
-
reset: () => void;
|
|
31
|
-
handleEvent: (event: DebugSessionEvent) => void;
|
|
32
|
-
setTerminal: (terminal?: TerminalControl) => void;
|
|
33
|
-
setAdapter: (adapter: DebugLanguageAdapter | null) => void;
|
|
34
|
-
setBreakpoints: (lines: number[]) => void;
|
|
35
|
-
setCursorLine: (line: number | null) => void;
|
|
36
|
-
sendCommand: (command: DebugCommand) => Promise<boolean>;
|
|
37
|
-
runToCursor: (targetLine?: number | null) => Promise<boolean>;
|
|
38
|
-
stop: () => Promise<boolean>;
|
|
39
|
-
addWatchExpression: (expression?: string) => boolean;
|
|
40
|
-
removeWatchExpression: (expression: string) => void;
|
|
41
|
-
clearWatches: () => void;
|
|
42
|
-
};
|
|
43
|
-
export type DebugSessionController = ReturnType<typeof createDebugSessionController>;
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { fromStore, get, writable } from 'svelte/store';
|
|
2
|
-
export function createDebugSessionController(options = {}) {
|
|
3
|
-
const activeStore = writable(false);
|
|
4
|
-
const pausedStore = writable(false);
|
|
5
|
-
const pausedLineStore = writable(null);
|
|
6
|
-
const localsStore = writable([]);
|
|
7
|
-
const callStackStore = writable([]);
|
|
8
|
-
const runToCursorLineStore = writable(null);
|
|
9
|
-
const watchInputStore = writable('');
|
|
10
|
-
const watchExpressionsStore = writable([]);
|
|
11
|
-
const watchValuesStore = writable([]);
|
|
12
|
-
const breakpointsStore = writable([...(options.breakpoints || [])]);
|
|
13
|
-
const cursorLineStore = writable(options.cursorLine ?? null);
|
|
14
|
-
const terminalStore = writable(options.terminal);
|
|
15
|
-
const adapterStore = writable(options.adapter ?? null);
|
|
16
|
-
const activeState = fromStore(activeStore);
|
|
17
|
-
const pausedState = fromStore(pausedStore);
|
|
18
|
-
const pausedLineState = fromStore(pausedLineStore);
|
|
19
|
-
const localsState = fromStore(localsStore);
|
|
20
|
-
const callStackState = fromStore(callStackStore);
|
|
21
|
-
const runToCursorLineState = fromStore(runToCursorLineStore);
|
|
22
|
-
const watchInputState = fromStore(watchInputStore);
|
|
23
|
-
const watchExpressionsState = fromStore(watchExpressionsStore);
|
|
24
|
-
const watchValuesState = fromStore(watchValuesStore);
|
|
25
|
-
const breakpointsState = fromStore(breakpointsStore);
|
|
26
|
-
const cursorLineState = fromStore(cursorLineStore);
|
|
27
|
-
const terminalState = fromStore(terminalStore);
|
|
28
|
-
const adapterState = fromStore(adapterStore);
|
|
29
|
-
let watchRequestVersion = 0;
|
|
30
|
-
function shouldSyncBreakpoints() {
|
|
31
|
-
if (typeof options.syncBreakpointsWhile === 'function') {
|
|
32
|
-
return options.syncBreakpointsWhile();
|
|
33
|
-
}
|
|
34
|
-
if (typeof options.syncBreakpointsWhile === 'boolean') {
|
|
35
|
-
return options.syncBreakpointsWhile;
|
|
36
|
-
}
|
|
37
|
-
return get(activeStore);
|
|
38
|
-
}
|
|
39
|
-
function getEffectiveBreakpoints() {
|
|
40
|
-
const lines = [...get(breakpointsStore)];
|
|
41
|
-
const runToCursorLine = get(runToCursorLineStore);
|
|
42
|
-
if (runToCursorLine !== null && !lines.includes(runToCursorLine))
|
|
43
|
-
lines.push(runToCursorLine);
|
|
44
|
-
return lines.sort((left, right) => left - right);
|
|
45
|
-
}
|
|
46
|
-
function refreshWatchValues() {
|
|
47
|
-
const expressions = [...get(watchExpressionsStore)];
|
|
48
|
-
const adapter = get(adapterStore);
|
|
49
|
-
const localVariables = [...get(localsStore)];
|
|
50
|
-
const paused = get(pausedStore);
|
|
51
|
-
const terminal = get(terminalStore);
|
|
52
|
-
const version = ++watchRequestVersion;
|
|
53
|
-
if (!expressions.length) {
|
|
54
|
-
watchValuesStore.set([]);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (paused && terminal?.debugEvaluate) {
|
|
58
|
-
watchValuesStore.set(expressions.map((expression) => ({ expression, value: '...' })));
|
|
59
|
-
(async () => {
|
|
60
|
-
const resolved = [];
|
|
61
|
-
for (const expression of expressions) {
|
|
62
|
-
resolved.push({
|
|
63
|
-
expression,
|
|
64
|
-
value: await terminal.debugEvaluate(expression)
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
if (version === watchRequestVersion)
|
|
68
|
-
watchValuesStore.set(resolved);
|
|
69
|
-
})().catch(() => {
|
|
70
|
-
if (version === watchRequestVersion) {
|
|
71
|
-
watchValuesStore.set(expressions.map((expression) => ({ expression, value: 'error' })));
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
watchValuesStore.set(expressions.map((expression) => {
|
|
77
|
-
try {
|
|
78
|
-
return {
|
|
79
|
-
expression,
|
|
80
|
-
value: adapter ? adapter.evaluateExpression(expression, localVariables) : 'error'
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
return {
|
|
85
|
-
expression,
|
|
86
|
-
value: error instanceof Error && error.message === 'unavailable' ? '?' : 'error'
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}));
|
|
90
|
-
}
|
|
91
|
-
function syncBreakpoints() {
|
|
92
|
-
const terminal = get(terminalStore);
|
|
93
|
-
if (!shouldSyncBreakpoints() || !terminal?.setBreakpoints)
|
|
94
|
-
return;
|
|
95
|
-
void terminal.setBreakpoints(getEffectiveBreakpoints());
|
|
96
|
-
}
|
|
97
|
-
function clearPauseState() {
|
|
98
|
-
runToCursorLineStore.set(null);
|
|
99
|
-
pausedLineStore.set(null);
|
|
100
|
-
localsStore.set([]);
|
|
101
|
-
callStackStore.set([]);
|
|
102
|
-
pausedStore.set(false);
|
|
103
|
-
}
|
|
104
|
-
function reset() {
|
|
105
|
-
activeStore.set(false);
|
|
106
|
-
clearPauseState();
|
|
107
|
-
refreshWatchValues();
|
|
108
|
-
}
|
|
109
|
-
function begin() {
|
|
110
|
-
activeStore.set(true);
|
|
111
|
-
clearPauseState();
|
|
112
|
-
refreshWatchValues();
|
|
113
|
-
syncBreakpoints();
|
|
114
|
-
}
|
|
115
|
-
function handleEvent(event) {
|
|
116
|
-
if (event.type === 'pause') {
|
|
117
|
-
activeStore.set(true);
|
|
118
|
-
runToCursorLineStore.set(null);
|
|
119
|
-
pausedLineStore.set(event.line);
|
|
120
|
-
localsStore.set(event.locals);
|
|
121
|
-
callStackStore.set(event.callStack);
|
|
122
|
-
pausedStore.set(true);
|
|
123
|
-
refreshWatchValues();
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (event.type === 'resume') {
|
|
127
|
-
pausedStore.set(false);
|
|
128
|
-
pausedLineStore.set(null);
|
|
129
|
-
localsStore.set([]);
|
|
130
|
-
callStackStore.set([]);
|
|
131
|
-
refreshWatchValues();
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
reset();
|
|
135
|
-
}
|
|
136
|
-
function setTerminal(terminal) {
|
|
137
|
-
terminalStore.set(terminal);
|
|
138
|
-
refreshWatchValues();
|
|
139
|
-
syncBreakpoints();
|
|
140
|
-
}
|
|
141
|
-
function setAdapter(adapter) {
|
|
142
|
-
adapterStore.set(adapter);
|
|
143
|
-
refreshWatchValues();
|
|
144
|
-
}
|
|
145
|
-
function setBreakpoints(lines) {
|
|
146
|
-
breakpointsStore.set([...lines]);
|
|
147
|
-
syncBreakpoints();
|
|
148
|
-
}
|
|
149
|
-
function setCursorLine(line) {
|
|
150
|
-
cursorLineStore.set(line);
|
|
151
|
-
}
|
|
152
|
-
function addWatchExpression(expression) {
|
|
153
|
-
const watchInput = get(watchInputStore);
|
|
154
|
-
const watchExpressions = get(watchExpressionsStore);
|
|
155
|
-
const nextExpression = (expression || watchInput).trim();
|
|
156
|
-
if (!nextExpression || watchExpressions.includes(nextExpression))
|
|
157
|
-
return false;
|
|
158
|
-
watchExpressionsStore.set([...watchExpressions, nextExpression]);
|
|
159
|
-
watchInputStore.set('');
|
|
160
|
-
refreshWatchValues();
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
function removeWatchExpression(expression) {
|
|
164
|
-
watchExpressionsStore.set(get(watchExpressionsStore).filter((entry) => entry !== expression));
|
|
165
|
-
refreshWatchValues();
|
|
166
|
-
}
|
|
167
|
-
function clearWatches() {
|
|
168
|
-
watchInputStore.set('');
|
|
169
|
-
watchExpressionsStore.set([]);
|
|
170
|
-
refreshWatchValues();
|
|
171
|
-
}
|
|
172
|
-
async function sendCommand(command) {
|
|
173
|
-
const terminal = get(terminalStore);
|
|
174
|
-
if (!terminal || !get(pausedStore))
|
|
175
|
-
return false;
|
|
176
|
-
await terminal.debugCommand(command);
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
|
-
async function runToCursor(targetLine = get(cursorLineStore)) {
|
|
180
|
-
const terminal = get(terminalStore);
|
|
181
|
-
const breakpoints = get(breakpointsStore);
|
|
182
|
-
if (!terminal ||
|
|
183
|
-
!get(pausedStore) ||
|
|
184
|
-
!targetLine ||
|
|
185
|
-
targetLine === get(pausedLineStore) ||
|
|
186
|
-
!terminal.setBreakpoints) {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
const nextBreakpoints = breakpoints.includes(targetLine)
|
|
190
|
-
? [...breakpoints]
|
|
191
|
-
: [...breakpoints, targetLine].sort((left, right) => left - right);
|
|
192
|
-
runToCursorLineStore.set(breakpoints.includes(targetLine) ? null : targetLine);
|
|
193
|
-
await terminal.setBreakpoints(nextBreakpoints);
|
|
194
|
-
await terminal.debugCommand('continue');
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
async function stop() {
|
|
198
|
-
const terminal = get(terminalStore);
|
|
199
|
-
if (!terminal)
|
|
200
|
-
return false;
|
|
201
|
-
reset();
|
|
202
|
-
await terminal.stop?.();
|
|
203
|
-
return true;
|
|
204
|
-
}
|
|
205
|
-
return {
|
|
206
|
-
get active() {
|
|
207
|
-
return activeState.current;
|
|
208
|
-
},
|
|
209
|
-
get paused() {
|
|
210
|
-
return pausedState.current;
|
|
211
|
-
},
|
|
212
|
-
get pausedLine() {
|
|
213
|
-
return pausedLineState.current;
|
|
214
|
-
},
|
|
215
|
-
get locals() {
|
|
216
|
-
return localsState.current;
|
|
217
|
-
},
|
|
218
|
-
get callStack() {
|
|
219
|
-
return callStackState.current;
|
|
220
|
-
},
|
|
221
|
-
get runToCursorLine() {
|
|
222
|
-
return runToCursorLineState.current;
|
|
223
|
-
},
|
|
224
|
-
get breakpoints() {
|
|
225
|
-
return breakpointsState.current;
|
|
226
|
-
},
|
|
227
|
-
get effectiveBreakpoints() {
|
|
228
|
-
return getEffectiveBreakpoints();
|
|
229
|
-
},
|
|
230
|
-
get cursorLine() {
|
|
231
|
-
return cursorLineState.current;
|
|
232
|
-
},
|
|
233
|
-
get canRunToCursor() {
|
|
234
|
-
const cursorLine = cursorLineState.current;
|
|
235
|
-
const terminal = terminalState.current;
|
|
236
|
-
return (pausedState.current &&
|
|
237
|
-
cursorLine !== null &&
|
|
238
|
-
cursorLine > 0 &&
|
|
239
|
-
cursorLine !== pausedLineState.current &&
|
|
240
|
-
!!terminal?.setBreakpoints);
|
|
241
|
-
},
|
|
242
|
-
get watchInput() {
|
|
243
|
-
return watchInputState.current;
|
|
244
|
-
},
|
|
245
|
-
set watchInput(value) {
|
|
246
|
-
watchInputStore.set(value);
|
|
247
|
-
},
|
|
248
|
-
get watchExpressions() {
|
|
249
|
-
return watchExpressionsState.current;
|
|
250
|
-
},
|
|
251
|
-
get watchValues() {
|
|
252
|
-
return watchValuesState.current;
|
|
253
|
-
},
|
|
254
|
-
begin,
|
|
255
|
-
reset,
|
|
256
|
-
handleEvent,
|
|
257
|
-
setTerminal,
|
|
258
|
-
setAdapter,
|
|
259
|
-
setBreakpoints,
|
|
260
|
-
setCursorLine,
|
|
261
|
-
sendCommand,
|
|
262
|
-
runToCursor,
|
|
263
|
-
stop,
|
|
264
|
-
addWatchExpression,
|
|
265
|
-
removeWatchExpression,
|
|
266
|
-
clearWatches
|
|
267
|
-
};
|
|
268
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MonacoDebugView, attachMonacoDebugActions } from './monaco';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { DebugVariable } from '../../playground/options';
|
|
2
|
-
import type { DebugLanguageAdapter } from '../language';
|
|
3
|
-
import type monaco from 'monaco-editor';
|
|
4
|
-
export type MonacoDebugActionsOptions = {
|
|
5
|
-
runToCursorLabel?: string;
|
|
6
|
-
onCursorLineChange?: (line: number | null) => void;
|
|
7
|
-
onRunToCursor?: (line: number | null) => void;
|
|
8
|
-
};
|
|
9
|
-
export declare class MonacoDebugView {
|
|
10
|
-
Monaco: typeof monaco;
|
|
11
|
-
editor: monaco.editor.IStandaloneCodeEditor;
|
|
12
|
-
breakpointDecorations: monaco.editor.IEditorDecorationsCollection;
|
|
13
|
-
inlineValueDecorations: monaco.editor.IEditorDecorationsCollection;
|
|
14
|
-
pausedLineWidget: monaco.editor.IContentWidget | null;
|
|
15
|
-
pausedLineWidgetNode: HTMLDivElement | null;
|
|
16
|
-
mouseHandler: monaco.IDisposable | null;
|
|
17
|
-
breakpoints: number[];
|
|
18
|
-
onBreakpointsChange?: (lines: number[]) => void;
|
|
19
|
-
constructor(MonacoModule: typeof monaco, editor: monaco.editor.IStandaloneCodeEditor, onBreakpointsChange?: (lines: number[]) => void);
|
|
20
|
-
setBreakpoints(lines: number[]): void;
|
|
21
|
-
setPauseState(pausedLine: number | null, locals: DebugVariable[], adapter: DebugLanguageAdapter | null): void;
|
|
22
|
-
dispose(): void;
|
|
23
|
-
}
|
|
24
|
-
export declare function attachMonacoDebugActions(editor: monaco.editor.IStandaloneCodeEditor, options?: MonacoDebugActionsOptions): {
|
|
25
|
-
dispose(): void;
|
|
26
|
-
};
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
export class MonacoDebugView {
|
|
2
|
-
Monaco;
|
|
3
|
-
editor;
|
|
4
|
-
breakpointDecorations;
|
|
5
|
-
inlineValueDecorations;
|
|
6
|
-
pausedLineWidget = null;
|
|
7
|
-
pausedLineWidgetNode = null;
|
|
8
|
-
mouseHandler = null;
|
|
9
|
-
breakpoints = [];
|
|
10
|
-
onBreakpointsChange;
|
|
11
|
-
constructor(MonacoModule, editor, onBreakpointsChange) {
|
|
12
|
-
this.Monaco = MonacoModule;
|
|
13
|
-
this.editor = editor;
|
|
14
|
-
this.onBreakpointsChange = onBreakpointsChange;
|
|
15
|
-
this.breakpointDecorations = editor.createDecorationsCollection();
|
|
16
|
-
this.inlineValueDecorations = editor.createDecorationsCollection();
|
|
17
|
-
this.mouseHandler = editor.onMouseDown((event) => {
|
|
18
|
-
if (event.target.type !== this.Monaco.editor.MouseTargetType.GUTTER_GLYPH_MARGIN &&
|
|
19
|
-
event.target.type !== this.Monaco.editor.MouseTargetType.GUTTER_LINE_DECORATIONS) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const line = event.target.position?.lineNumber;
|
|
23
|
-
if (!line)
|
|
24
|
-
return;
|
|
25
|
-
const next = this.breakpoints.includes(line)
|
|
26
|
-
? this.breakpoints.filter((value) => value !== line)
|
|
27
|
-
: [...this.breakpoints, line].sort((a, b) => a - b);
|
|
28
|
-
this.onBreakpointsChange?.(next);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
setBreakpoints(lines) {
|
|
32
|
-
this.breakpoints = lines;
|
|
33
|
-
this.breakpointDecorations.set(lines.map((line) => ({
|
|
34
|
-
range: new this.Monaco.Range(line, 1, line, 1),
|
|
35
|
-
options: {
|
|
36
|
-
isWholeLine: false,
|
|
37
|
-
glyphMarginClassName: 'debug-breakpoint-glyph',
|
|
38
|
-
glyphMarginHoverMessage: { value: 'Breakpoint' }
|
|
39
|
-
}
|
|
40
|
-
})));
|
|
41
|
-
}
|
|
42
|
-
setPauseState(pausedLine, locals, adapter) {
|
|
43
|
-
const lineMaxColumn = pausedLine ? this.editor.getModel()?.getLineMaxColumn(pausedLine) || 1 : 1;
|
|
44
|
-
if (pausedLine) {
|
|
45
|
-
const fontInfo = this.editor.getOption(this.Monaco.editor.EditorOption.fontInfo);
|
|
46
|
-
if (!this.pausedLineWidgetNode) {
|
|
47
|
-
this.pausedLineWidgetNode = document.createElement('div');
|
|
48
|
-
this.pausedLineWidgetNode.className = 'debug-paused-line-widget';
|
|
49
|
-
}
|
|
50
|
-
this.pausedLineWidgetNode.style.height = `${fontInfo.lineHeight}px`;
|
|
51
|
-
this.pausedLineWidgetNode.style.width = `${this.editor.getLayoutInfo().contentWidth}px`;
|
|
52
|
-
if (!this.pausedLineWidget) {
|
|
53
|
-
this.pausedLineWidget = {
|
|
54
|
-
getId: () => 'wasm-idle-debug-current-line',
|
|
55
|
-
getDomNode: () => this.pausedLineWidgetNode,
|
|
56
|
-
getPosition: () => ({
|
|
57
|
-
position: { lineNumber: pausedLine, column: 1 },
|
|
58
|
-
preference: [this.Monaco.editor.ContentWidgetPositionPreference.EXACT]
|
|
59
|
-
})
|
|
60
|
-
};
|
|
61
|
-
this.editor.addContentWidget(this.pausedLineWidget);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
this.editor.layoutContentWidget(this.pausedLineWidget);
|
|
65
|
-
}
|
|
66
|
-
this.editor.revealLineInCenterIfOutsideViewport(pausedLine);
|
|
67
|
-
}
|
|
68
|
-
else if (this.pausedLineWidget) {
|
|
69
|
-
this.editor.removeContentWidget(this.pausedLineWidget);
|
|
70
|
-
this.pausedLineWidget = null;
|
|
71
|
-
this.pausedLineWidgetNode = null;
|
|
72
|
-
}
|
|
73
|
-
const inlineLocals = pausedLine && adapter
|
|
74
|
-
? adapter.selectInlineLocals(this.editor.getModel()?.getLineContent(pausedLine) || '', locals)
|
|
75
|
-
: [];
|
|
76
|
-
this.inlineValueDecorations.set(pausedLine && inlineLocals.length
|
|
77
|
-
? [
|
|
78
|
-
{
|
|
79
|
-
range: new this.Monaco.Range(pausedLine, lineMaxColumn, pausedLine, lineMaxColumn),
|
|
80
|
-
options: {
|
|
81
|
-
showIfCollapsed: true,
|
|
82
|
-
after: {
|
|
83
|
-
content: ` ${inlineLocals
|
|
84
|
-
.map((variable) => `${variable.name} = ${variable.value}`)
|
|
85
|
-
.join(', ')}`,
|
|
86
|
-
inlineClassName: 'debug-inline-values',
|
|
87
|
-
inlineClassNameAffectsLetterSpacing: true
|
|
88
|
-
},
|
|
89
|
-
zIndex: 20
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
]
|
|
93
|
-
: []);
|
|
94
|
-
}
|
|
95
|
-
dispose() {
|
|
96
|
-
this.breakpointDecorations.clear();
|
|
97
|
-
this.inlineValueDecorations.clear();
|
|
98
|
-
if (this.pausedLineWidget)
|
|
99
|
-
this.editor.removeContentWidget(this.pausedLineWidget);
|
|
100
|
-
this.pausedLineWidget = null;
|
|
101
|
-
this.pausedLineWidgetNode = null;
|
|
102
|
-
this.mouseHandler?.dispose();
|
|
103
|
-
this.mouseHandler = null;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
export function attachMonacoDebugActions(editor, options = {}) {
|
|
107
|
-
const disposables = [];
|
|
108
|
-
disposables.push(editor.onDidChangeCursorPosition((event) => {
|
|
109
|
-
options.onCursorLineChange?.(event.position?.lineNumber || null);
|
|
110
|
-
}));
|
|
111
|
-
options.onCursorLineChange?.(editor.getPosition()?.lineNumber || 1);
|
|
112
|
-
if (options.onRunToCursor) {
|
|
113
|
-
disposables.push(editor.addAction({
|
|
114
|
-
id: 'wasm-idle-run-to-cursor',
|
|
115
|
-
label: options.runToCursorLabel || 'Run to Cursor',
|
|
116
|
-
contextMenuGroupId: 'navigation',
|
|
117
|
-
contextMenuOrder: 0.5,
|
|
118
|
-
run: () => options.onRunToCursor?.(editor.getPosition()?.lineNumber || null)
|
|
119
|
-
}));
|
|
120
|
-
}
|
|
121
|
-
return {
|
|
122
|
-
dispose() {
|
|
123
|
-
while (disposables.length)
|
|
124
|
-
disposables.pop()?.dispose();
|
|
125
|
-
options.onCursorLineChange?.(null);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { DebugVariable } from '../playground/options';
|
|
2
|
-
export type DebugExpressionScalar = number | boolean | string | null;
|
|
3
|
-
export type DebugExpressionArray = DebugExpressionValue[] & {
|
|
4
|
-
truncated?: boolean;
|
|
5
|
-
};
|
|
6
|
-
export interface DebugExpressionIndexedValue {
|
|
7
|
-
__debugExpressionKind: 'array';
|
|
8
|
-
length?: number;
|
|
9
|
-
truncated?: boolean;
|
|
10
|
-
get: (index: number) => DebugExpressionValue;
|
|
11
|
-
keys?: () => number[];
|
|
12
|
-
}
|
|
13
|
-
export interface DebugExpressionObjectValue {
|
|
14
|
-
__debugExpressionKind: 'object';
|
|
15
|
-
has: (name: string) => boolean;
|
|
16
|
-
get: (name: string) => DebugExpressionValue;
|
|
17
|
-
keys?: () => string[];
|
|
18
|
-
}
|
|
19
|
-
export interface DebugExpressionRecord {
|
|
20
|
-
[key: string]: DebugExpressionValue;
|
|
21
|
-
}
|
|
22
|
-
export type DebugExpressionValue = DebugExpressionScalar | DebugExpressionArray | DebugExpressionIndexedValue | DebugExpressionObjectValue | DebugExpressionRecord;
|
|
23
|
-
export declare const parseStoredDebugValue: (value: string) => DebugExpressionValue;
|
|
24
|
-
export declare const formatDebugExpressionValue: (value: DebugExpressionValue) => string;
|
|
25
|
-
export declare const evaluateDebugExpressionWithResolver: (expression: string, resolveIdentifier: (name: string) => DebugExpressionValue) => string;
|
|
26
|
-
export declare function evaluateDebugExpression(expression: string, variables: DebugVariable[]): string;
|