From 3c8e73cbc81ee1ca09132269574f9f800c9eeb79 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 29 Jan 2021 10:09:52 +1000 Subject: [PATCH 1/8] 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 6e352e8196..18f16c1687 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/8] 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 88b249157f..6ba8704913 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/8] 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 6ba8704913..921cc20513 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/8] 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 18f16c1687..1a2a6c1f1e 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/8] 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 1a2a6c1f1e..e2beefcc0f 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 d3769ad00f..0348e10e52 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/8] 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 921cc20513..a93e57c7fc 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)] From 2823b2729b8165c342773ed8122033337660fade Mon Sep 17 00:00:00 2001 From: "Raymond E. Pasco" Date: Tue, 2 Mar 2021 14:00:12 -0500 Subject: [PATCH 7/8] Change PNG aura from @t to @ No PNG is (sane %t) - the PNG header alone isn't. This should also be octs, not an atom, as a binary filetype - it works for PNG purely by coincidence (no valid PNG can end with a sequence of 00 bytes, because they have to end with 00 00 00 00 49 45 4e 44 ae 42 60 82). --- pkg/arvo/mar/png.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/mar/png.hoon b/pkg/arvo/mar/png.hoon index e68e502cd1..6a60a6a27b 100644 --- a/pkg/arvo/mar/png.hoon +++ b/pkg/arvo/mar/png.hoon @@ -1,4 +1,4 @@ -|_ dat=@t +|_ dat=@ ++ grow |% ++ mime [/image/png (as-octs:mimes:html dat)] @@ -6,7 +6,7 @@ ++ grab |% ++ mime |=([p=mite q=octs] q.q) - ++ noun @t + ++ noun @ -- ++ grad %mime -- From 883a56382ffc280b4b611fc0ba14365b91c4ac78 Mon Sep 17 00:00:00 2001 From: fang Date: Wed, 3 Mar 2021 17:14:07 +0100 Subject: [PATCH 8/8] tally: be safer wrt mangled metadata Previously, if metadata-store said a graph existed, we'd unconditionally scry for it. Now, we make sure the graph actually exists, to avoid risking a crash. --- pkg/arvo/gen/tally.hoon | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/gen/tally.hoon b/pkg/arvo/gen/tally.hoon index 75e3a53cc0..fbaf04e0a9 100644 --- a/pkg/arvo/gen/tally.hoon +++ b/pkg/arvo/gen/tally.hoon @@ -61,14 +61,24 @@ ::NOTE we only count graphs for now ?. &(=(%graph app-name.m) =(our creator.metadatum)) ~ `[module.metadatum resource.m] +:: for sanity checks +:: +=/ real=(set resource:re) + =/ upd=update:ga + %+ scry update:ga + [%x %graph-store /keys/graph-update] + ?> ?=(%keys -.q.upd) + resources.q.upd :: count activity per channel :: =/ activity=(list [resource:re members=@ud (list [resource:re mod=term week=@ud authors=@ud])]) %+ turn crowds |= [g=resource:re m=@ud] :+ g m - %+ turn (~(got by channels) g) + %+ murn (~(got by channels) g) |= [m=term r=resource:re] + ?. (~(has in real) r) ~ + %- some :+ r m ::NOTE graph-store doesn't use the full resource-style path here! =/ upd=update:ga