Fork me on GitHub
#portal
<
2023-10-25
>
chromalchemy19:10:42

@clojurians.net How do I re-open a playback portal window (in vscode) if I manually closed it? If I run the preload code it says “Looks like Portal is already open.” If I run (portal/sessions) it shows an empty list. How would I properly close the playback portal session?

chromalchemy19:10:55

Another question: I’m trying to show some slurped csv as a table. I have it parsed into a list of maps.

#>(->>
    (slurp ".myfile.csv")
    (separator/read-records)
    (transform [ALL MAP-KEYS] keyword))
I see normal maps in repl. When I evaluate the code with playback I see this

chromalchemy19:10:26

I can click the 124, change the viewer to table, and get this

chromalchemy19:10:39

But when I evaluate the code again, it goes back to the first view.. How can I keep the “nested?” list value selected? Why isn’t portal remembering the viewer? Do I need to set it in metadata. What is the top level metadata value good for for casual print debugging? Is it getting in the way in this case? When I select the most top level in portal (so the whole value window is highlighted, I cannot select table viewer.. I apologize if these are all know in Portal best practices..

gnl20:10:07

Check out the recently updated documentation on how to easily define helper functions in the user namespace to set the default portal viewer with metadata: • https://github.com/gnl/playback/#quick-start-and-walkthrough Second tip from the bottom of the section.

gnl20:10:42

I'll have a look at the session re-opening issue, I might have an unnecessary check in there...

gnl20:10:46

I'm currently thinking about if and how to support the workflow where you tap> an atom to portal and then reset! that with the new value to have it updated in Portal (Chris described it in the thread you linked to)

gnl20:10:03

For now you could do something like this:

(def !a (atom nil))
#> !a
(reset! !a (...)) ; <-- and only re-eval this form in the REPL

gnl20:10:32

Personally I prefer not to do the atom thing here, so I can do diffs between the current and the previous evaluation, but sometimes it does make sense.

gnl20:10:54

@U09D96P9B I just deployed 0.5.2-SNAPSHOT disabling the check, give it a shot and let me know.

gnl12:10:44

It should now also automatically clear previous Portal sessions if you try to re-open it.

chromalchemy14:10:37

Cool, thanks! Will try it again. So i can set a default viewer in the Playback preload. But can I stably set and/or maintain a soecific viewer for a specific form? Ex: a certain fn that is always going to be a table, but the table viewer should not be (and cannot be) the global default. I believe in the std Portal tap, if you change the viewer for a form, portal will remember for that session. @U1G869VNV just showed you can declare a default for the form (to show in first evaluation) with metadata before the form. Need to try that out in general Im looking to use Playback or Calva’s Tap helpers so i can evaluate things richly on the fly, with minimal ceremony updating the code to be evaluated.

chromalchemy14:10:02

For context, beyond usual ergonomics, i am looking to use these affordances to evaluate code in different ways with audible commands via Cursorless / Talon Ie: “eval <target-form>’s top level form in portal with <portal-viewer>” , etc (not actual grammar)

djblue20:10:24

Docs look like they are back up, https://github.com/djblue/portal/tree/master/doc is also available if cljdoc is down

chromalchemy20:10:30

Is there a way to set a stable default viewer on a code bock (value?). Kinda like clerk does it (with metadata preceding the from)? Or does medata always need to be inside tap call?

djblue20:10:12

I think the following should work:

^{:portal.viewer/default :portal.viewer/hiccup} [:portal.viewer/code "(+ 1 2 3)"]

djblue20:10:45

I will add the code viewer to https://github.com/djblue/portal/blob/master/src/portal/viewer.cljc before the next release to make it a bit easier 👌

chromalchemy14:10:21

Thanks 🙌 will try it out