Can now save (apply) stuff from textEditor with annotations

This commit is contained in:
Dustin Swan 2026-03-28 22:39:20 -06:00
parent 479abf7996
commit ef48a4f468
No known key found for this signature in database
GPG key ID: 30D46587E2100467
2 changed files with 5 additions and 3 deletions

View file

@ -138,7 +138,8 @@ textEditor = name \
{ state = state, emit = [rebindAt [buffersKey, name] content] };
apply = state \
content = name & " = " & (join "\n" state.lines) & ";";
# content = name & " = " & (join "\n" state.lines) & ";";
content = (join "\n" state.lines);
result = eval! content;
_ = debug! "apply" [content, result];
result

View file

@ -202,7 +202,7 @@ export const _rt = {
const trimmed = code.trim();
// is it a definition
const defMatch = /^([a-z_][a-zA-Z0-9_]*)\s*=(?![=])/.exec(trimmed);
const defMatch = /^([a-z_][a-zA-Z0-9_]*)\s*[:=]/.exec(trimmed);
if (defMatch) {
try {
@ -214,7 +214,8 @@ export const _rt = {
if (defs.length > 0) {
const def = defs[0];
recompile(def.name, def.body!);
const source = prettyPrint({ kind: 'definition', name: def.name, body: def.body });
definitions.set(def.name, def);
const source = prettyPrint(def);
appendChangeLog(def.name, source);
saveDefinitions();
return { _tag: 'Defined', _0: def.name };