/ proof-of-concept / soundbox
Sign in
proof-of-concept / soundbox
Highlight each scene's own op names in the Lab editor; add browser smoke test
Jeremy Magland <jeremy.magland@gmail.com> committed commit 8333c762e95d parent 761af16 Browse files
1 changed file+7−1
src/main.tsmodified+7−1View file
@@ -131,10 +131,13 @@ new ResizeObserver(() => {
131131 }).observe(canvas);
132132
133133 const editorFile = el<HTMLSelectElement>('editor-file');
134+/** The host-provided names the editor highlights; refilled per scene, since
135+ * the op set (dxx_s1, lap_m1, ...) is the scene's own. */
136+const externalNames = new Set(['sponge3']);
134137 const editor = new CodeEditor({
135138 textarea: el<HTMLTextAreaElement>('source'),
136139 overlay: el('highlight'),
137- external: new Set(['sponge3']),
140+ external: externalNames,
138141 onInput: (value) => {
139142 sources[editorFile.value as 'model' | 'scene'] = value;
140143 el<HTMLButtonElement>('recompile').classList.add('primary');
@@ -472,6 +475,9 @@ async function rebuild(): Promise<void> {
472475 showStatics();
473476 el<HTMLButtonElement>('recompile').classList.remove('primary');
474477 el('compiled').textContent = describe(next);
478+ externalNames.clear();
479+ externalNames.add('sponge3');
480+ for (const op of next.generated.ops) externalNames.add(op.name);
475481 showFile(editorFile.value as 'model' | 'scene');
476482 drawSpec();
477483 } catch (e) {
↑↓ move↵openescclose