diff --git a/playground/TODO.md b/playground/TODO.md index 9668543..e83ce45 100644 --- a/playground/TODO.md +++ b/playground/TODO.md @@ -8,6 +8,8 @@ - [x] tabs for source, compiler output - [x] Show errors in editor - [x] show tabs on rhs - - [ ] editor is a tab on mobile -- [ ] publish / host on github -- [ ] multiple files + - [ ] make editor a tab on mobile + - (or possibly put the tab bar under the keyboard) +- [x] publish / host on github +- [ ] multiple persistent files +- [x] kill return for autocomplete diff --git a/playground/samples/Day1.newt b/playground/samples/Day1.newt index c02c6ff..a291ddf 100644 --- a/playground/samples/Day1.newt +++ b/playground/samples/Day1.newt @@ -1,6 +1,5 @@ module Day1 --- Need to visit Lib.newt for this to work in playground import Lib digits1 : List Char -> List Int diff --git a/playground/samples/Day2.newt b/playground/samples/Day2.newt index 176063b..7e2cbde 100644 --- a/playground/samples/Day2.newt +++ b/playground/samples/Day2.newt @@ -1,6 +1,5 @@ module Day2 --- Need to visit Lib.newt for this to work in playground import Lib Draw : U diff --git a/playground/samples/Tree.newt b/playground/samples/Tree.newt index 2594a8e..7d98c62 100644 --- a/playground/samples/Tree.newt +++ b/playground/samples/Tree.newt @@ -73,7 +73,6 @@ TooBig l u h = Sg Nat (\ x => T23 l (N x) h * T23 (N x) u h) insert : {h : Nat} {l u : Bnd} -> Intv l u -> T23 l u h -> TooBig l u h + T23 l u h -- Agda is yellow here, needs h = x on each leaf --- The second arg to the second _,_ is unsolved and pi-typed insert (intv x lx xu) (leaf lu) = inl (x , (leaf {_} {_} {x} lx , leaf {_} {_} {x} xu)) insert (intv x lx xu) (node2 y tly tyu) = case cmp x y of -- u := N y is not solved at this time diff --git a/playground/src/main.ts b/playground/src/main.ts index a7d9ccb..3b702eb 100644 --- a/playground/src/main.ts +++ b/playground/src/main.ts @@ -74,6 +74,7 @@ function Editor({ initialValue }: EditorProps) { language: "newt", theme: "vs", automaticLayout: true, + acceptSuggestionOnEnter: "off", unicodeHighlight: { ambiguousCharacters: false }, minimap: { enabled: false }, }); diff --git a/playground/src/worker.ts b/playground/src/worker.ts index 1b769f1..2cd2b3a 100644 --- a/playground/src/worker.ts +++ b/playground/src/worker.ts @@ -64,9 +64,7 @@ let shim: any = { let buf2 = new TextEncoder().encode(line); handle.buf = Buffer.concat([handle.buf, buf2]) }, - chmodSync(fn: string, mode: number) { - console.log('chmod', fn, mode) - }, + chmodSync(fn: string, mode: number) { }, readSync(fd: number, buf: Buffer, start: number, len: number) { let hand = fds[fd]; let avail = hand.buf.byteLength - hand.pos; @@ -118,8 +116,18 @@ let stdout = '' process.stdout.write = (s) => { stdout += s }; +// hack for now +const preload = ["Lib.newt"] +onmessage = async function (e) { + for (let fn of preload) { -onmessage = function (e) { + if (!files['src/'+fn]) { + console.log('preload', fn) + let res = await fetch(fn) + let text = await res.text() + files['src/'+fn] = text + } + } let {src} = e.data let module = 'Main' let m = src.match(/module (\w+)/)