Bundle language tools with CodeMirror package

This commit is contained in:
2026-07-09 21:25:04 +09:00
parent 59cb8f31e4
commit 8eac5c5cb4
24 changed files with 155 additions and 219 deletions
+4 -4
View File
@@ -1,10 +1,10 @@
import initRuntime, { evaluateProject } from 'decodal-wasm';
import runtimeWasmUrl from 'decodal-wasm/decodal_wasm_bg.wasm?url';
import initTools, { formatSource } from 'decodal-language-tools';
import toolsWasmUrl from 'decodal-language-tools/decodal_language_tools_bg.wasm?url';
import { EditorView, basicSetup } from 'codemirror';
import { keymap } from '@codemirror/view';
import { decodal } from 'decodal-codemirror';
import { formatDecodal, initDecodalFormatter } from 'decodal-codemirror/format';
import toolsWasmUrl from 'decodal-codemirror/wasm/decodal_language_tools_bg.wasm?url';
import { playgroundExamples } from './playground-examples.js';
const STORAGE_KEY = 'decodal-playground-project-v2';
@@ -221,7 +221,7 @@ function execute() {
}
function formatActiveFile() {
const result = JSON.parse(formatSource(getEditorText()));
const result = formatDecodal(getEditorText());
if (!result.ok) {
output.textContent = result.error;
output.classList.add('error');
@@ -285,7 +285,7 @@ function compareNodes(a, b) {
}
try {
await Promise.all([initRuntime(runtimeWasmUrl), initTools(toolsWasmUrl)]);
await Promise.all([initRuntime(runtimeWasmUrl), initDecodalFormatter(toolsWasmUrl)]);
run.disabled = false;
formatButton.disabled = false;
status.textContent = '';