Fork me on GitHub
#portal
<
2021-11-10
>
wilkerlucio01:11:42

is it possible from the client side to extend Portal to support other custom views? I would like to try to embed Pathom Graph Viz inside portal, all I need is a way to inject an iframe and do a postmessage to it (I would be using the embed client of Pathom Viz, which is hosted and compiled, making it easier to embed in web environments)

markaddleman03:11:36

This plus some jump to source magic would be awesome!

djblue03:11:10

I haven't considered what a client side extension api would look like, would be interested in your ideas.

djblue03:11:20

@U2845S9KL I would checkout the portal.runtime.jvm.editor/goto-definition command, or the g d shortcut ๐Ÿ™Œ

๐Ÿ‘ 1
djblue03:11:45

It should work in intellij ๐Ÿ’ฏ

djblue03:11:07

Should work with strings, files, namespaces, symbols and maps generated by https://github.com/djblue/portal/blob/master/src/portal/console.cljc#L20-L28

wilkerlucio12:11:21

@U1G869VNV sorry, missed the responses here. about the API, I think an initial thing could be aroudn the currenct Hiccup renderer, since it allows some arbitrary HTML, what I'm missing at this point is how, from inside the hiccup also re-use the renderers available from Portal, maybe there is a way to make them accessible from the hiccup, maybe something like:

(tap> ^{:portal.viewer/default :portal.viewer/hiccup} 
  [:div "custom thing here" [:portal.viewer/inspector {:complex :data-structure}]])

wilkerlucio12:11:03

ups, actually, it already works ๐Ÿ˜„

wilkerlucio12:11:46

this is so cool! now I can have log messages like these ๐ŸŽ‰ here I'm using logs that are like event maps, instead of text strings, using this custom hiccup I can have both the event name kw isolated, while have the log details in another separate thing (so I can always see the event names, but only expand the details when I need it)

1
wilkerlucio12:11:37

this is the code for it:

(defn portal-logger []
  (fn [{::l/keys [event level line column timestamp namespace] :as log}]
    (tap>
      {:level  (l/level-unqualified-kw level)
       :result (with-meta
                 [:div
                  [:portal.viewer/inspector event]
                  [:portal.viewer/inspector (dissoc log ::l/event ::l/level ::l/line ::l/column ::l/timestamp ::l/namespace)]]
                 {:portal.viewer/default :portal.viewer/hiccup})
       :ns     'some.ns
       :line   line
       :column column
       :time   timestamp})))

1
1
djblue04:11:50

portal https://github.com/djblue/portal/releases/tag/0.18.0 ๐ŸŽ‰ Thanks for all the feedback!

1
๐Ÿ‘ 1
seancorfield05:11:01

Won't get a chance to try this until tomorrow but "thank you!"

๐Ÿ’ฏ 1
R.A. Porter05:11:54

Installed the new IJ plugin and updated library and now when passing in {:launcher :intellij} it's not starting up in the tool window now. I'll try a restart in case to confirm...

R.A. Porter05:11:20

Ignore me. The restart did it. It's late; maybe I just forgot to restart after installing the new plugin.

R.A. Porter05:11:04

But, it still seems to have the problem @U066U8JQJ reported earlier with styling.

djblue05:11:50

I think you might also need to bump the version running in process ๐Ÿ‘Œ

djblue05:11:07

The plugin only acts as a way to launch the UI hosted by your clojure process in your editor.

R.A. Porter06:11:27

I'll double check tomorrow. Thought I had bumped that as well, though

๐Ÿ‘ 1
R.A. Porter13:11:52

Steps to reproduce (for me, running v21.2.3 Ultimate on JDK 11 on Big Sur) 1. Start REPL with IJ (NREPL, using the Cursive/IJ standard launching process) 2. Start Portal 3. Stop REPL 4. Restart REPL 5. Start Portal On restart, the theming is going back to Portal defaults.

djblue17:11:01

Can you verify that if you call open again after step 5 it goes back to the correct theme?

R.A. Porter17:11:00

It did go back to correct theming if I open a second time.

djblue17:11:39

Thanks for verifying! Will see what I can do to fix the race :thumbsup:

seancorfield19:11:48

Confirmed this fixes the VS Code focus issue -- thank you!

awesome 1
djblue19:11:00

I think the / shortcut still has a few edge cases, but it should work a little better. I need to rethink implementation.

seancorfield20:11:36

BTW, those arrow characters are still unrenderable on my old Mac - I wasn't sure whether you were planning to change them?

seancorfield20:11:55

(and the four history ones as well)

djblue21:11:32

I do plan on fixing the issue, just haven't prioritized it yet :thumbsup:

1
djblue23:11:39

https://github.com/djblue/portal/commit/1f1049eb488b8640ab04f1222299aac091e8f76e should fix it. Just switched to using icons so I don't have to worry about fonts ๐Ÿ˜†

1
David Pham21:11:47

Thanks for the the experimental remote mode :)

๐Ÿ‘ 1
felipethome16:11:40

Hi! It appears portal window is on top of the intellij buttons that appear on the right side of the screen (figure 1: the portal window covering the buttons, figure 2: just my repl and the buttons appearing):

djblue16:11:38

Interesting, haven't seen this issue before :thinking_face:

felipethome22:11:08

btw, I leave these buttons hidden and only show them when I press cmd twice

felipethome22:11:45

I will try to switch themes to see if it still happens (I use the Material theme in intellij)

djblue22:11:27

Are the buttons hidden if you hit the button on the bottom left corner?

felipethome22:11:39

do you mean bottom right? If I click on the repl button they continue to be hidden

djblue22:11:10

This button

felipethome22:11:43

Nope, if I click on that button they will show up

felipethome22:11:29

btw, changed my theme to darcula just to be sure it wasnโ€™t the Material theme

djblue22:11:52

I would try resizing the tool window real quick. I wonder if there is a bug related to resize for https://plugins.jetbrains.com/docs/intellij/jcef.html

felipethome22:11:20

the resizing behavior is very different between the repl and the portal window. when resizing the window, for portal appears a white background, while the repl is more smooth the buttons also show up for a moment during resize

djblue23:11:06

Is cmd+cmd a custom shortcut? If so, what is it calling?

felipethome00:11:21

I canโ€™t find this in keymap, but it is not custom: https://youtrack.jetbrains.com/issue/IDEA-203999

felipethome00:11:20

This is the only resource I found talking about this shortcut though. I donโ€™t remember how I learned it ๐Ÿ˜…

felipethome00:11:58

This is a very low priority thing, if you donโ€™t want to pursue this anymore it is fine for me! Thank you for the attention I agree with you it looks more as a bug on intellij side than on Portal

djblue01:11:31

I might look more into it after I get some higher priority items done. If you are feeling adventurous, you can run the plugin from the https://github.com/djblue/portal/tree/master/extension-intellij directory from intellij. You can even enable a https://github.com/djblue/portal/blob/master/extension-intellij/build.gradle#L27-L28 server into intellij for some repl driven development ๐Ÿ™Œ

djblue01:11:46

Thanks again for raising this issue :thumbsup:

๐Ÿ‘ 1
wilkerlucio12:11:46

this is so cool! now I can have log messages like these ๐ŸŽ‰ here I'm using logs that are like event maps, instead of text strings, using this custom hiccup I can have both the event name kw isolated, while have the log details in another separate thing (so I can always see the event names, but only expand the details when I need it)

1