From 3c8e73cbc81ee1ca09132269574f9f800c9eeb79 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 29 Jan 2021 10:09:52 +1000 Subject: [PATCH 1/6] Revert "language-server: parse commands permissively" This reverts commit 8f8ec8bcc5b413e7bed66a5f747ac4e76ba3ab44. --- pkg/arvo/lib/language-server/complete.hoon | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/lib/language-server/complete.hoon b/pkg/arvo/lib/language-server/complete.hoon index 6e352e819..18f16c168 100644 --- a/pkg/arvo/lib/language-server/complete.hoon +++ b/pkg/arvo/lib/language-server/complete.hoon @@ -247,15 +247,15 @@ :: ++ get-id |= [pos=@ud txt=tape] - ^- [forward=(unit @t) backward=(unit @t) id=(unit @t)] - =/ seek - ;~(sfix (punt (cook crip (star prn))) (star ;~(pose prn (just `@`10)))) - =/ forward=(unit @t) - (scan (slag pos txt) seek) - =/ backward=(unit @t) + ^- [forward=(unit term) backward=(unit term) id=(unit term)] + =/ forward=(unit term) + %+ scan `tape`(slag pos txt) + ;~(sfix (punt sym) (star ;~(pose prn (just `@`10)))) + =/ backward=(unit term) %- (lift |=(t=@tas (swp 3 t))) - (scan (flop (scag pos txt)) seek) - =/ id=(unit @t) + %+ scan `tape`(flop (scag pos txt)) + ;~(sfix (punt sym) (star ;~(pose prn (just `@`10)))) + =/ id=(unit term) ?~ forward ?~ backward ~ From 410fe58975754dbeb8cd6e3525f4aa31f62a0ddf Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 29 Jan 2021 11:43:40 +1000 Subject: [PATCH 2/6] language-server: ignore /sys files --- pkg/arvo/app/language-server.hoon | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/language-server.hoon b/pkg/arvo/app/language-server.hoon index 88b249157..6ba870491 100644 --- a/pkg/arvo/app/language-server.hoon +++ b/pkg/arvo/app/language-server.hoon @@ -275,12 +275,14 @@ ++ handle-did-open |= item=text-document-item:lsp-sur ^- (quip card _state) + =/ =path + (uri-to-path:build uri.item) + ?: ?=(%sys -.path) + `state =/ buf=wall (to-wall (trip text.item)) =. bufs (~(put by bufs) uri.item buf) - =/ =path - (uri-to-path:build uri.item) :_ state %+ weld (give-rpc-notification (get-diagnostics uri.item)) From b4cbe7b5ebf86fc6a5ec408b39a8f01794a4f69a Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 29 Jan 2021 11:44:13 +1000 Subject: [PATCH 3/6] language-server: prettier hover format --- pkg/arvo/app/language-server.hoon | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/app/language-server.hoon b/pkg/arvo/app/language-server.hoon index 6ba870491..921cc2051 100644 --- a/pkg/arvo/app/language-server.hoon +++ b/pkg/arvo/app/language-server.hoon @@ -320,12 +320,12 @@ ?~ p.tab-list ~ ?~ u.p.tab-list ~ :- ~ - %- crip - ;: weld - "`" - ~(ram re ~(duck easy-print detail.i.u.p.tab-list)) - "`" - == + =- (crip :(weld "```hoon\0a" tape "\0a```")) + ^- =tape + %- zing + %+ join "\0a" + %+ scag 20 + (~(win re ~(duck easy-print detail.i.u.p.tab-list)) 2 80) :: ++ sync-buf |= [buf=wall changes=(list change:lsp-sur)] From 377b2cd10ca2db9cf0103bee9be9f85438315aa0 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 29 Jan 2021 11:44:37 +1000 Subject: [PATCH 4/6] language-server: prevent %play-open on %zpgl --- pkg/arvo/lib/language-server/complete.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/lib/language-server/complete.hoon b/pkg/arvo/lib/language-server/complete.hoon index 18f16c168..1a2a6c1f1 100644 --- a/pkg/arvo/lib/language-server/complete.hoon +++ b/pkg/arvo/lib/language-server/complete.hoon @@ -185,6 +185,7 @@ [%zpmc *] (both p.gen q.gen) [%zpts *] loop(gen p.gen) [%zppt *] (both q.gen r.gen) + [%zpgl *] (spec-and-hoon p.gen q.gen) [%zpzp *] ~ * =+ doz=~(open ap gen) From 7b46b8bfed104f0c019ec143eba73c12dd1904f5 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 29 Jan 2021 12:01:33 +1000 Subject: [PATCH 5/6] language-server: break up parser from shoe --- pkg/arvo/lib/language-server/complete.hoon | 32 ++++++++++++++-------- pkg/arvo/lib/shoe.hoon | 2 +- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/pkg/arvo/lib/language-server/complete.hoon b/pkg/arvo/lib/language-server/complete.hoon index 1a2a6c1f1..e2beefcc0 100644 --- a/pkg/arvo/lib/language-server/complete.hoon +++ b/pkg/arvo/lib/language-server/complete.hoon @@ -246,17 +246,27 @@ ^- (unit [term type]) ~ :: +++ get-id-sym + |= [pos=@ud =tape] + %^ get-id pos tape + ^- $-(nail (like (unit @t))) + ;~(sfix (punt sym) (star ;~(pose prn (just `@`10)))) +:: +++ get-id-cord + |= [pos=@ud =tape] + %^ get-id pos tape + ^- $-(nail (like (unit @t))) + ;~(sfix (punt (cook crip (star prn))) (star ;~(pose prn (just `@`10)))) +:: ++ get-id - |= [pos=@ud txt=tape] - ^- [forward=(unit term) backward=(unit term) id=(unit term)] - =/ forward=(unit term) - %+ scan `tape`(slag pos txt) - ;~(sfix (punt sym) (star ;~(pose prn (just `@`10)))) - =/ backward=(unit term) - %- (lift |=(t=@tas (swp 3 t))) - %+ scan `tape`(flop (scag pos txt)) - ;~(sfix (punt sym) (star ;~(pose prn (just `@`10)))) - =/ id=(unit term) + |= [pos=@ud txt=tape seek=$-(nail (like (unit @t)))] + ^- [forward=(unit @t) backward=(unit @t) id=(unit @t)] + =/ forward=(unit @t) + (scan (slag pos txt) seek) + =/ backward=(unit @t) + %- (lift |=(t=@t (swp 3 t))) + (scan (flop (scag pos txt)) seek) + =/ id=(unit @t) ?~ forward ?~ backward ~ @@ -273,7 +283,7 @@ ^- [back-pos=@ud fore-pos=@ud txt=tape] :: Find beg-pos by searching backward to where the current term :: begins - =+ (get-id pos txt) + =+ (get-id-sym pos txt) =/ back-pos ?~ backward pos diff --git a/pkg/arvo/lib/shoe.hoon b/pkg/arvo/lib/shoe.hoon index d3769ad00..0348e10e5 100644 --- a/pkg/arvo/lib/shoe.hoon +++ b/pkg/arvo/lib/shoe.hoon @@ -291,7 +291,7 @@ ++ tab |= pos=@ud ^- (quip card _cli-state) - =+ (get-id:auto pos (tufa buf.cli-state)) + =+ (get-id-cord:auto pos (tufa buf.cli-state)) =/ needle=term (fall id %$) :: autocomplete empty command iff user at start of command From ac7aa12dd76b5e95a15ee7ec7563d65f311ab5dd Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Sat, 30 Jan 2021 12:09:59 +1000 Subject: [PATCH 6/6] language-server: retain state on reload --- pkg/arvo/app/language-server.hoon | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/app/language-server.hoon b/pkg/arvo/app/language-server.hoon index 921cc2051..a93e57c7f 100644 --- a/pkg/arvo/app/language-server.hoon +++ b/pkg/arvo/app/language-server.hoon @@ -5,7 +5,7 @@ easy-print=language-server-easy-print, rune-snippet=language-server-rune-snippet, build=language-server-build, - default-agent + default-agent, verb |% +$ card card:agent:gall +$ lsp-req @@ -44,6 +44,7 @@ == -- ^- agent:gall +%+ verb | =| state-zero =* state - =< @@ -69,7 +70,7 @@ |= old-state=vase ^- (quip card _this) ~& > %lsp-upgrade - [~ this(state *state-zero)] + [~ this(state !<(state-zero old-state))] :: ++ on-poke ^+ on-poke:*agent:gall @@ -324,8 +325,8 @@ ^- =tape %- zing %+ join "\0a" - %+ scag 20 - (~(win re ~(duck easy-print detail.i.u.p.tab-list)) 2 80) + %+ scag 40 + (~(win re ~(duck easy-print detail.i.u.p.tab-list)) 0 140) :: ++ sync-buf |= [buf=wall changes=(list change:lsp-sur)]