mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-05 05:45:46 +03:00
language-server: cleanup and incremental text sync
This commit is contained in:
parent
da71dac4ab
commit
647c0ddf8b
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:11e608f3e5f0dd4860d19131c6c91550514f1e65a2229f9ee6ba0146e9ea7229
|
oid sha256:54e54a61856bd1efed91dd313a0394dfc41a40fb6aefcfa78c03bcdd958d2594
|
||||||
size 9093157
|
size 9423845
|
||||||
|
@ -1055,6 +1055,11 @@
|
|||||||
:: ~& [%his-clock ler.cal]
|
:: ~& [%his-clock ler.cal]
|
||||||
:: ~& [%our-clock ven.say]
|
:: ~& [%our-clock ven.say]
|
||||||
=^ dat say (~(transceive sole say) cal)
|
=^ dat say (~(transceive sole say) cal)
|
||||||
|
:: speedrun mode
|
||||||
|
:: =; res
|
||||||
|
:: ?. ?=(%del -.dat)
|
||||||
|
:: res
|
||||||
|
:: (he-tab:res +(p.dat))
|
||||||
?. ?& ?=($del -.dat)
|
?. ?& ?=($del -.dat)
|
||||||
=(+(p.dat) (lent buf.say))
|
=(+(p.dat) (lent buf.say))
|
||||||
==
|
==
|
||||||
|
@ -12,19 +12,32 @@
|
|||||||
==
|
==
|
||||||
::
|
::
|
||||||
+$ lsp-req
|
+$ lsp-req
|
||||||
$% [%sync text=@t]
|
$% [%sync changes=(list change)]
|
||||||
[%completion row=@ud col=@ud]
|
[%completion position]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
+$ state
|
+$ change
|
||||||
[buf=@t cache=(tri @tD [hair hoon]) cache-size=@]
|
$: 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]
|
|_ [bow=bowl:gall state]
|
||||||
::
|
::
|
||||||
++ this .
|
++ this .
|
||||||
++ tall-cached
|
++ tall
|
||||||
(ifix [gay gay] tall:[%*(. vast fat cache)])
|
(ifix [gay gay] tall:vast)
|
||||||
::
|
::
|
||||||
++ prep
|
++ prep
|
||||||
|= old=(unit state)
|
|= old=(unit state)
|
||||||
@ -33,7 +46,7 @@
|
|||||||
?~ old
|
?~ old
|
||||||
:_ this
|
:_ this
|
||||||
[ost.bow %connect / [~ /'~language-server-protocol'] %language-server]~
|
[ost.bow %connect / [~ /'~language-server-protocol'] %language-server]~
|
||||||
[~ this(+<+< -.u.old)]
|
[~ this(buf u.old)]
|
||||||
::
|
::
|
||||||
:: alerts us that we were bound.
|
:: alerts us that we were bound.
|
||||||
::
|
::
|
||||||
@ -44,19 +57,46 @@
|
|||||||
::
|
::
|
||||||
:: +poke-handle-http-request: received on a new connection established
|
:: +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
|
++ poke-handle-http-request
|
||||||
%- (require-authorization:app ost.bow move this)
|
%- (require-authorization:app ost.bow move this)
|
||||||
|= =inbound-request:eyre
|
|= =inbound-request:eyre
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
?> ?=(^ body.request.inbound-request)
|
?> ?=(^ body.request.inbound-request)
|
||||||
=/ =lsp-req
|
=/ =lsp-req
|
||||||
%. (need (de-json:html q.u.body.request.inbound-request))
|
%- parser
|
||||||
=, dejs:format
|
(need (de-json:html q.u.body.request.inbound-request))
|
||||||
%- of
|
=^ out-jon buf
|
||||||
:~ sync+so
|
|
||||||
completion+(ot line+ni character+ni ~)
|
|
||||||
==
|
|
||||||
=^ out-jon +<+.this
|
|
||||||
?- -.lsp-req
|
?- -.lsp-req
|
||||||
%sync (handle-sync +.lsp-req)
|
%sync (handle-sync +.lsp-req)
|
||||||
%completion (handle-completion +.lsp-req)
|
%completion (handle-completion +.lsp-req)
|
||||||
@ -64,54 +104,47 @@
|
|||||||
[[ost.bow %http-response (json-response:app (json-to-octs out-jon))]~ this]
|
[[ost.bow %http-response (json-response:app (json-to-octs out-jon))]~ this]
|
||||||
::
|
::
|
||||||
++ handle-sync
|
++ handle-sync
|
||||||
|= text=@t
|
|= changes=(list change)
|
||||||
=, enjs:format
|
:- *json
|
||||||
[*json text cache cache-size]
|
|- ^- 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)
|
||||||
::
|
::
|
||||||
::
|
++ to-wall
|
||||||
++ ingest
|
|= =tape
|
||||||
=| count=@
|
^- wall
|
||||||
|= =wall
|
%+ roll (flop tape)
|
||||||
^- (tri @tD [hair hoon])
|
|= [char=@tD =wall]
|
||||||
?~ wall
|
?~ wall
|
||||||
[~ ~]
|
[[char ~] ~]
|
||||||
=. count +(count)
|
?: =('\0a' char)
|
||||||
?: (gth count (sub (lent wall) cache-size))
|
[~ wall]
|
||||||
cache
|
[[char i.wall] t.wall]
|
||||||
=. 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)
|
|
||||||
::
|
::
|
||||||
++ try
|
++ get-pos
|
||||||
|* [los=tape sab=rule]
|
|= position
|
||||||
=+ vex=(sab [[1 1] los])
|
^- @ud
|
||||||
?~ q.vex
|
?~ buf
|
||||||
~
|
0
|
||||||
:: Finished with spaces remaining
|
?: =(0 row)
|
||||||
::
|
col
|
||||||
=/ rows (sub p.p.q.u.q.vex 1)
|
%+ add +((lent i.buf)) :: +1 because newline
|
||||||
=/ cols
|
$(row (dec row), buf t.buf)
|
||||||
?: =(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]
|
|
||||||
::
|
::
|
||||||
++ safe-sub
|
++ safe-sub
|
||||||
|= [a=@ b=@]
|
|= [a=@ b=@]
|
||||||
@ -121,28 +154,23 @@
|
|||||||
::
|
::
|
||||||
++ handle-completion
|
++ handle-completion
|
||||||
|= [row=@ud col=@ud]
|
|= [row=@ud col=@ud]
|
||||||
^- [json @t (tri @tD [hair hoon]) @]
|
^- [json wall]
|
||||||
=/ =wain (to-wain:format buf)
|
=/ =tape (zing (join "\0a" buf))
|
||||||
=/ =wall (turn wain trip)
|
=/ pos (get-pos row col)
|
||||||
:: =? cache (lth cache-size (lent wall)) (ingest wall)
|
:_ buf
|
||||||
:: =. cache-size (min (lent wall) (add cache-size 100))
|
:: Check if we're on a rune
|
||||||
=/ =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)
|
|
||||||
=/ rune (swag [(safe-sub pos 2) 2] tape)
|
=/ rune (swag [(safe-sub pos 2) 2] tape)
|
||||||
?: (~(has by runes:rune-snippet) rune)
|
?: (~(has by runes:rune-snippet) rune)
|
||||||
(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
|
=/ tl
|
||||||
(tab-list-tape:auto -:!>(..zuse) pos tape cache)
|
(tab-list-tape:auto -:!>(..zuse) pos tape)
|
||||||
=, enjs:format
|
=, enjs:format
|
||||||
?: ?=(%| -.tl)
|
?: ?=(%| -.tl)
|
||||||
%- pairs
|
%- pairs
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
:: Autocomplete for hoon.
|
:: Autocomplete for hoon.
|
||||||
::
|
::
|
||||||
|
=/ debug |
|
||||||
|%
|
|%
|
||||||
+$ ids (list [=term =type])
|
+$ ids (list [=term =type])
|
||||||
::
|
::
|
||||||
@ -310,18 +311,18 @@
|
|||||||
:: Same as +advance-hoon, but takes a position and text directly.
|
:: Same as +advance-hoon, but takes a position and text directly.
|
||||||
::
|
::
|
||||||
++ tab-list-tape
|
++ 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=@])
|
^- (each (unit ids) [row=@ col=@])
|
||||||
~& > %start-magick
|
~? > debug %start-magick
|
||||||
=/ magicked txt:(insert-magic pos code)
|
=/ magicked txt:(insert-magic pos code)
|
||||||
~& > %start-parsing
|
~? > debug %start-parsing
|
||||||
=/ parser
|
=/ parser
|
||||||
(ifix [gay gay] tall:[%*(. vast fat cache)])
|
(ifix [gay gay] tall:vast)
|
||||||
=/ res (lily magicked parser)
|
=/ res (lily magicked parser)
|
||||||
?: ?=(%| -.res)
|
?: ?=(%| -.res)
|
||||||
~& > [%parsing-error p.res]
|
~? > debug [%parsing-error p.res]
|
||||||
[%| p.res]
|
[%| p.res]
|
||||||
:- %&
|
:- %&
|
||||||
~& > %parsed-good
|
~? > debug %parsed-good
|
||||||
((cury tab-list-hoon sut) p.res)
|
((cury tab-list-hoon sut) p.res)
|
||||||
--
|
--
|
||||||
|
@ -1817,32 +1817,6 @@
|
|||||||
?~(r.a [~ n.a] $(a r.a))
|
?~(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 ::
|
:::: 2o: containers ::
|
||||||
:: ::
|
:: ::
|
||||||
::
|
::
|
||||||
@ -1864,11 +1838,6 @@
|
|||||||
$| (tree item)
|
$| (tree item)
|
||||||
|=(a=(tree) ~(apt in a))
|
|=(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 ::
|
:::: 2l: container from container ::
|
||||||
:: ::
|
:: ::
|
||||||
::
|
::
|
||||||
@ -11967,7 +11936,7 @@
|
|||||||
%*(. vast bug bug, wer wer) :: wer: where we are
|
%*(. vast bug bug, wer wer) :: wer: where we are
|
||||||
::
|
::
|
||||||
++ vast :: main parsing core
|
++ vast :: main parsing core
|
||||||
=+ [bug=`?`| wer=*path fat=*(tri @tD [hair hoon])]
|
=+ [bug=`?`| wer=*path]
|
||||||
|%
|
|%
|
||||||
++ gash %+ cook :: parse path
|
++ gash %+ cook :: parse path
|
||||||
|= a/(list tyke) ^- tyke
|
|= a/(list tyke) ^- tyke
|
||||||
@ -14131,21 +14100,7 @@
|
|||||||
(punt ;~(pfix ;~(pose net tis) wyde))
|
(punt ;~(pfix ;~(pose net tis) wyde))
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
++ tall
|
++ tall :: full tall form
|
||||||
|= 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
|
|
||||||
%+ knee *hoon
|
%+ knee *hoon
|
||||||
|.(~+((wart ;~(pose expression:(norm &) long lute apex:(sail &)))))
|
|.(~+((wart ;~(pose expression:(norm &) long lute apex:(sail &)))))
|
||||||
++ till :: mold tall form
|
++ till :: mold tall form
|
||||||
|
Loading…
Reference in New Issue
Block a user