diff --git a/bin/solid.pill b/bin/solid.pill index 243924533..59da577a5 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:11e608f3e5f0dd4860d19131c6c91550514f1e65a2229f9ee6ba0146e9ea7229 -size 9093157 +oid sha256:54e54a61856bd1efed91dd313a0394dfc41a40fb6aefcfa78c03bcdd958d2594 +size 9423845 diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index fc9673890..428860f60 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -1055,6 +1055,11 @@ :: ~& [%his-clock ler.cal] :: ~& [%our-clock ven.say] =^ dat say (~(transceive sole say) cal) + :: speedrun mode + :: =; res + :: ?. ?=(%del -.dat) + :: res + :: (he-tab:res +(p.dat)) ?. ?& ?=($del -.dat) =(+(p.dat) (lent buf.say)) == diff --git a/pkg/arvo/app/language-server.hoon b/pkg/arvo/app/language-server.hoon index bf68c1151..186d4bbd4 100644 --- a/pkg/arvo/app/language-server.hoon +++ b/pkg/arvo/app/language-server.hoon @@ -12,19 +12,32 @@ == :: +$ lsp-req - $% [%sync text=@t] - [%completion row=@ud col=@ud] + $% [%sync changes=(list change)] + [%completion position] == :: -+$ state - [buf=@t cache=(tri @tD [hair hoon]) cache-size=@] ++$ change + $: range=(unit range) + range-length=(unit @ud) + text=@t + == +:: ++$ range + $: start=position + end=position + == +:: ++$ position + [row=@ud col=@ud] +:: ++$ state buf=wall -- :: |_ [bow=bowl:gall state] :: ++ this . -++ tall-cached - (ifix [gay gay] tall:[%*(. vast fat cache)]) +++ tall + (ifix [gay gay] tall:vast) :: ++ prep |= old=(unit state) @@ -33,7 +46,7 @@ ?~ old :_ this [ost.bow %connect / [~ /'~language-server-protocol'] %language-server]~ - [~ this(+<+< -.u.old)] + [~ this(buf u.old)] :: :: alerts us that we were bound. :: @@ -44,19 +57,46 @@ :: :: +poke-handle-http-request: received on a new connection established :: +++ parser + =, dejs:format + |^ + %- of + :~ sync+sync + completion+position + == + :: + ++ sync + %- ar + %: ou + range+(uf ~ (pe ~ range)) + 'rangeLength'^(uf ~ (pe ~ ni)) + text+(un so) + ~ + == + :: + ++ range + %: ot + start+position + end+position + ~ + == + :: + ++ position + %: ot + line+ni + character+ni + ~ + == + -- ++ poke-handle-http-request %- (require-authorization:app ost.bow move this) |= =inbound-request:eyre ^- (quip move _this) ?> ?=(^ body.request.inbound-request) =/ =lsp-req - %. (need (de-json:html q.u.body.request.inbound-request)) - =, dejs:format - %- of - :~ sync+so - completion+(ot line+ni character+ni ~) - == - =^ out-jon +<+.this + %- parser + (need (de-json:html q.u.body.request.inbound-request)) + =^ out-jon buf ?- -.lsp-req %sync (handle-sync +.lsp-req) %completion (handle-completion +.lsp-req) @@ -64,54 +104,47 @@ [[ost.bow %http-response (json-response:app (json-to-octs out-jon))]~ this] :: ++ handle-sync - |= text=@t - =, enjs:format - [*json text cache cache-size] + |= changes=(list change) + :- *json + |- ^- wall + ?~ changes + buf + ?: ?|(?=(~ range.i.changes) ?=(~ range-length.i.changes)) + =/ =wain (to-wain:format text.i.changes) + =. buf (turn wain trip) + $(changes t.changes) + =/ =tape (zing (join "\0a" buf)) + =/ start-pos (get-pos start.u.range.i.changes) + =/ end-pos (get-pos end.u.range.i.changes) + =. tape + ;: weld + (scag start-pos tape) + (trip text.i.changes) + (slag end-pos tape) + == + =. buf (to-wall tape) + $(changes t.changes) :: -:: -++ ingest - =| count=@ - |= =wall - ^- (tri @tD [hair hoon]) +++ to-wall + |= =tape + ^- wall + %+ roll (flop tape) + |= [char=@tD =wall] ?~ wall - [~ ~] - =. count +(count) - ?: (gth count (sub (lent wall) cache-size)) - cache - =. cache $(wall t.wall) - ?: (lth count (sub (sub (lent wall) cache-size) 100)) - cache - ~? =(0 (mod (lent wall) 100)) - [%ingest-round (lent wall)] - =/ =tape (zing (join "\0a" wall)) - =/ mab (try tape tall-cached) - ?~ mab - cache - :: ~& >>> [- +<]:u.mab - (~(put up cache) u.mab) + [[char ~] ~] + ?: =('\0a' char) + [~ wall] + [[char i.wall] t.wall] :: -++ try - |* [los=tape sab=rule] - =+ vex=(sab [[1 1] los]) - ?~ q.vex - ~ - :: Finished with spaces remaining - :: - =/ rows (sub p.p.q.u.q.vex 1) - =/ cols - ?: =(0 rows) - (sub q.p.q.u.q.vex 1) - q.p.q.u.q.vex - =/ used-tape - (scag (sub (lent los) (lent q.q.u.q.vex)) los) - ?. ?=([?(%32 %10) *] (flop used-tape)) - :: ~& >>> no=used-tape - ~ - :- ~ - ^= u - :: ~& > [p.q.u.q.vex ppv=p.p.vex qpv=q.p.vex tol=(sub (lent los) (lent q.q.u.q.vex)) ll=(lent los) lq=(lent q.q.u.q.vex)] - :: ~& >> yes=used-tape - [used-tape [rows cols] p.u.q.vex] +++ get-pos + |= position + ^- @ud + ?~ buf + 0 + ?: =(0 row) + col + %+ add +((lent i.buf)) :: +1 because newline + $(row (dec row), buf t.buf) :: ++ safe-sub |= [a=@ b=@] @@ -121,28 +154,23 @@ :: ++ handle-completion |= [row=@ud col=@ud] - ^- [json @t (tri @tD [hair hoon]) @] - =/ =wain (to-wain:format buf) - =/ =wall (turn wain trip) - :: =? cache (lth cache-size (lent wall)) (ingest wall) - :: =. cache-size (min (lent wall) (add cache-size 100)) - =/ =tape (zing (join "\0a" wall)) - =/ pos - |- ^- @ud - ?~ wain - 0 - ?: =(0 row) - col - %+ add +((met 3 i.wain)) :: +1 because newline - $(row (dec row), wain t.wain) - :_ [buf cache cache-size] - ~& >>> bef=(swag [(safe-sub pos 2) 2] tape) + ^- [json wall] + =/ =tape (zing (join "\0a" buf)) + =/ pos (get-pos row col) + :_ buf + :: Check if we're on a rune + :: =/ rune (swag [(safe-sub pos 2) 2] tape) ?: (~(has by runes:rune-snippet) rune) (rune-snippet rune) + :: Don't run on large files because it's slow + :: + ?: (gth (lent buf) 1.000) + =, enjs:format + (pairs good+b+& result+~ ~) :: =/ tl - (tab-list-tape:auto -:!>(..zuse) pos tape cache) + (tab-list-tape:auto -:!>(..zuse) pos tape) =, enjs:format ?: ?=(%| -.tl) %- pairs diff --git a/pkg/arvo/lib/auto.hoon b/pkg/arvo/lib/auto.hoon index fc1951808..93a7c9c29 100644 --- a/pkg/arvo/lib/auto.hoon +++ b/pkg/arvo/lib/auto.hoon @@ -1,5 +1,6 @@ :: Autocomplete for hoon. :: +=/ debug | |% +$ ids (list [=term =type]) :: @@ -310,18 +311,18 @@ :: Same as +advance-hoon, but takes a position and text directly. :: ++ tab-list-tape - |= [sut=type pos=@ud code=tape cache=(tri @tD [hair hoon])] + |= [sut=type pos=@ud code=tape] ^- (each (unit ids) [row=@ col=@]) - ~& > %start-magick + ~? > debug %start-magick =/ magicked txt:(insert-magic pos code) - ~& > %start-parsing + ~? > debug %start-parsing =/ parser - (ifix [gay gay] tall:[%*(. vast fat cache)]) + (ifix [gay gay] tall:vast) =/ res (lily magicked parser) ?: ?=(%| -.res) - ~& > [%parsing-error p.res] + ~? > debug [%parsing-error p.res] [%| p.res] :- %& - ~& > %parsed-good + ~? > debug %parsed-good ((cury tab-list-hoon sut) p.res) -- diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 9979bd094..4b11fe2fb 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -1817,32 +1817,6 @@ ?~(r.a [~ n.a] $(a r.a)) -- :: -++ up - !: - =| a=(tri * *) - =* val-t ?>(?=(^ val.a) val.a) - |@ - ++ put - |* [b=(list *) c=*] - => .(b (homo b)) - |- ^+ a - ?~ b - a(val `c) - =/ son (~(gut by kid.a) i.b [~ ~]) - a(kid (~(put by kid.a) i.b $(a son, b t.b))) - :: - ++ get - |* b=(list *) - => .(b (homo b)) - |- - ?~ b - [~ val.a] - =/ son (~(get by kid.a) i.b) - ?~ son - [b val.a] - $(a u.son, b t.b) - -- -:: :::: 2o: containers :: :: :: :: @@ -1864,11 +1838,6 @@ $| (tree item) |=(a=(tree) ~(apt in a)) :: -++ tri :: trie - |$ [key-t val-t] - $~ [~ ~] - [val=(unit val-t) kid=(map key-t (tri key-t val-t))] -:: :::: 2l: container from container :: :: :: :: @@ -11967,7 +11936,7 @@ %*(. vast bug bug, wer wer) :: wer: where we are :: ++ vast :: main parsing core - =+ [bug=`?`| wer=*path fat=*(tri @tD [hair hoon])] + =+ [bug=`?`| wer=*path] |% ++ gash %+ cook :: parse path |= a/(list tyke) ^- tyke @@ -14131,21 +14100,7 @@ (punt ;~(pfix ;~(pose net tis) wyde)) == == - ++ tall - |= tub=nail - =+ ^- [t=tape h=(unit [=hair =hoon])] - (~(get up fat) q.tub) - ?^ h - ~& > [%tall-cache-hit len=(lent t) hair=hair.u.h] - ~? (lth (lent t) 200) t=t - =/ =hair - ?: =(0 p.hair.u.h) - [p=p.p.tub q=(add q.p.tub q.hair.u.h)] - [p=(add p.p.tub p.hair.u.h) q=q.hair.u.h] - [p=hair q=`u=[p=hoon.u.h q=[p=hair q=t]]] - (tale tub) - :: - ++ tale :: full tall form + ++ tall :: full tall form %+ knee *hoon |.(~+((wart ;~(pose expression:(norm &) long lute apex:(sail &))))) ++ till :: mold tall form