This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-09
Channels
- # announcements (3)
- # beginners (61)
- # biff (20)
- # cider (13)
- # clerk (6)
- # clojure (58)
- # clojure-brasil (5)
- # clojure-europe (30)
- # clojure-nl (1)
- # clojure-norway (10)
- # clojure-uk (5)
- # clr (25)
- # core-async (2)
- # cursive (19)
- # datahike (5)
- # datalevin (1)
- # docker (1)
- # emacs (3)
- # fulcro (4)
- # hoplon (3)
- # hyperfiddle (91)
- # java (2)
- # juxt (5)
- # london-clojurians (1)
- # lsp (38)
- # malli (12)
- # nrepl (9)
- # off-topic (7)
- # polylith (15)
- # portal (49)
- # rdf (2)
- # re-frame (43)
- # releases (2)
- # shadow-cljs (30)
- # spacemacs (15)
- # sql (36)
- # tools-build (20)
- # xtdb (3)
Pathom3 does Smart Maps, which mutate on key access. And smart maps can be datafied and nav'ed. Portal seems to have a "nav, then choose to datafy (Shift-Enter), then nav again" workflow. How do you all stay in datafy-ied world? Every nav I do, I want to immediately datafy.
Yeah, currently Portal treats those as two separate operations. Ideally the nav implemention would return the datafied value, but it seems the nav fn is implemented by the pathom library :thinking_face:
I think a way to solve this might be to allow users to specify their own "nav" implemention which could provide arbitrary extensibility :thinking_face:
:thinking_face:
REBL/Morse stays in the "datafy" world. Arrow-ing in to the val pulls the next part of the Pathom universe out.
If, and only if, you tap>
a datafy
-ied val.
It feels like this to me: When I datafy
, I always want nav
-then-`datafy` to happen when I navigate.
How does one know if a value is datafied or not? I know there is metadata but that isn't guaranteed right?
I thought REBL shows both value
and (datafy value)
in different panels? (it's been a while since I used it)
If you're about to nav
, you always want something that has had datafy
called on it, but you don't necessary want datafy
automatically called on things -- and you can't have nav
automatically call datafy
either... because until an "object" has been datafied, you may not have the data/key/value that need in order to call nav
.
Just looked at the Morse source (because now we can) and when you nav
, it renders the output (in the right hand panel) with datafy
after calling nav
. But the left hand panel is "original".
and as you drill down, it does nav
-then-`datafy` each time...
And it can do that because it has two panels: one is the "original" value (the "browser" portion) and one is the datafied value (the right hand side).
Portal is flexible enough to let you build a similar UI and could then show "original" values in one panel and datafied values in a second panel, then when you nav
, that result becomes the next "original" value and the datafied version of it could appear in the second panel.
Because of the way Portal works, I actually updated next.jdbc
to essentially auto-datafy result set rows (since there's no transformation involved, just metadata -- and I was already adding metadata for ratification), to make it easier to navigate through the database...
But you pretty much need two output windows to do what REBL/Morse does (and I think what Reveal does? Again, it's been a while)
I find myself navigating to the unknown-value
val and pressing Enter.
Then immediately pressing Shift-Enter to resolve the value.
I would like those two steps to be one
And Pathom3 also auto-datafy results, it's wonderful to Just navigate through the data like this!
You can't have auto-datafy in general tho' because sometime the un-datafied value is more useful/important.
I use the jedi-time
library which adds datification to Java Time values -- which produces hash maps -- which is useful for viewing sometimes but would be very counter-productive if it happened automatically while you are just viewing date/time values in Portal 😕
Yeah... maybe Portal could add an extra keybinding for nav
-and-then-`datafy`?
And I think that kind of has to be built-in since it's wired into the UI/navigation? @U1G869VNV?
I think for now, something like this should get you going @U9E8C7QRJ:
(require '[portal.runtime :as rt])
(require '[clojure.datafy :as d])
(defn- nav [coll k v] (d/datafy (d/nav coll k v)))
(rt/register! #'nav {:name 'clojure.datafy/nav})
I'll see if I can come up with some sort of api to support this officially :thinking_face:Maybe meta+enter
could be the nav
-then-`datafy`?
I'm hoping to enable this sort of api for custom commands:
(require '[clojure.datafy :as d])
(defn nav-then-datafy
{:portal.shortcuts/default #{"meta" "enter"}}
[value]
(d/datafy (d/nav coll k v)))
(p/register! #'nav-then-datafy)
Oh, nice! And how would that show up in the commands list?
I would expect it to show up like most of the other commands with hard-coded shortcuts, which I would probably transition to leverage the the api 👌
The thing I'm still trying to figure out is how to enable editor specific config of bindings. That way users could manage / sync all of their bindings via their editor :thinking_face:
Not sure if this is an important use case, but wanted to give it some consideration before committing to any specific path
Or perhaps like the ~/.config/calva/config.edn
file Calva reads for all the custom REPL snippets, and you just manage it via git/dot-files kind of stuff?
(that makes it easier to write code rather than strings-of-code)
I'm not opposed to just exposing this via clojure, then the config.edn would work right away :thinking_face:
Would you expect to be able to override shortcuts for commands that you don't control? And if so, how would you expect that to work?
You mean, provide alternate implementations for built-in commands? I would not expect that. Just to add new commands and shortcuts.
I can see arguments pro and con there... but I don't think that I, personally, would care about that much...
Portal has it's own internal notation, but I haven't looked around to see what others do / expect
It looks like all the commands are functions of state
? So it feels like quite a bit of internal knowledge of Portal would be required?
Some of the commands are UI commands, others are runtime commands. The runtime ones only get passed the selected values.
@U1G869VNV it works a treat now. Thank you!