Bundle language tools with CodeMirror package
This commit is contained in:
@@ -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 = '';
|
||||
|
||||
Reference in New Issue
Block a user