Fork me on GitHub
#portal
<
2022-03-24
>
Jordan Robinson09:03:37

Hello, I'm struggling to get portal working as an intellij plugin. I've installed it but I just get a blank white screen if I open the tool window - running the examples in the readme also doesn't seem to change anything. I'm on ubuntu linux 20.04.3 and running intellij 2021.3.2 (Ultimate Edition), portal version 0.22.1. I had a quick grep through the logs and the only thing that looks like it might be related is a cursive exception that I'll add in thread. Is there any troubleshooting or other steps I can try to help debug the issue? Thanks!

Jordan Robinson09:03:05

not sure how helpful this is but here's the blank screen in question:

R.A. Porter12:03:31

When you run the fn in your repl to open portal, what is returned?

Jordan Robinson12:03:30

(p/open {:launcher :intellij})
=> {:session-id #uuid"62d44ce2-fb30-4f43-9a8a-52043c40d4ec"}

djblue15:03:43

@UC3B7UJF2 Do you have a .portal/intellij.edn at the root of your project?

Jordan Robinson15:03:53

I do not, should I?

Jordan Robinson15:03:11

all I've done so far is install then follow this: https://github.com/djblue/portal#api

djblue15:03:48

Yeah, that's how the repl process and intellij plugin coordinate communication. You shouldn't need to create it manually, it should be auto created when the plugin initializes.

djblue15:03:07

Maybe try another restart and see if the file shows up?

Jordan Robinson15:03:23

I will, that's also interesting in that I have a multi-module project so let me do a bit of investigation based on what you've said and see if that's causing a problem

🙌 1
Jordan Robinson15:03:29

thanks for the help so far btw 👍

Jordan Robinson16:03:59

ahh I see, okay I think I understand the problem, my folder structure looks like (config contains the .idea etc folders)

.
├── config
         └──.portal 
├── module-1
├── module-2
└── module-3

Jordan Robinson16:03:02

I can probably wrangle it into being more normal, I only set it up like that so there wasn't files everywhere in my root directory

Jordan Robinson16:03:08

thanks for the help 👍

djblue16:03:02

I think a quick hack would be to symlink it to the parent directory 👌

👍 1
Jordan Robinson16:03:17

ah great idea, and it works perfectly now, thanks so much 🙂

👏 1
staypufd01:06:50

Is this stuff in the docs anywhere? I was dorking around trying to get IntelliJ to open the window and then I noticed the side-tab that has Portal in it already, but it would be good to capture this so others see it in the docs.

Carlo12:03:40

I ended up coding my own visualization for malli generative testing, that looks like:

👏 1
nmkip18:04:31

@UA7E6DU04 do you mind sharing how to achieve something like this?

Carlo18:04:52

Not at all, let me put the library on github

Carlo18:04:18

it's very simple, it only contains a multimethod to generate the right hiccup based on which type of malli error you get (like ::m/invalid-input, those are the same malli use for its prettifier)

Carlo18:04:56

so, let's see, in order to use it, you should add in your project the deps.edn coordinate

Carlo18:04:09

then require it in your file

Carlo18:04:09

and then, for instrumentation, you should use:

(dev/start! {:report portal.malli.visualizer/display-malli-error})

Carlo18:04:38

dev is or malli.dev.cljs, depending on which kind of project you are using

Carlo18:04:45

while for generative checking, I have this little emacs setup:

(defun med/cider-eval-on-top-level-form (fn-str)
  (let ((quoted-defn (concat "'" (cider-defun-at-point))))
    (cider-interactive-eval (concat "(" fn-str " " quoted-defn ")"))))

(defun malli-check-this ()
  (interactive)
  (med/cider-eval-on-top-level-form
   "#(portal.malli.visualizer/check->portal (mi/check {:filters [(mi/-filter-var #{(resolve (second %))})]}))"))

(defun malli-check-all ()
  (interactive)
  (cider-interactive-eval "(-> (mi/check) portal.malli.visualizer/check->portal)"))
that will call the functions in that namespace 😂

Carlo18:04:53

I'll probably make a blogpost when this workflow is more settled down, which includes all my emacs-portal-malli setup, but feel free to ask more questions in the meantime ☺️

😁 1
nmkip18:04:21

Thanks a lot!! I'll try it after I finish working 🙂

🙌 1
nmkip18:04:46

Yes, I will 😄 I'm trying to improve my emacs-portal workflow too

Carlo13:03:30

About custom visualizers: here's what I think about how the functionality could be exposed. We should have essentially an atom containing (semantically) a list of visualizers (name, recognizer, code). As an example, the malli generative testing I did before has as a recognizer a malli/validate predicate, which checks if we have a generative checking error, and as a visualizer, I built a hiccup form and wrapped it in the correct metadata. The design principles that I would care about are: being able to access the visualizers atom programmatically, and being able to use in my recognisers and visualizers libraries that I don't necessarily have in my original program (and this could be the difficult part, maybe it's not even needed if we curate the dependencies that we have)

steffan17:03:15

I'm just trying Portal for the first time in IntelliJ and am having trouble getting the Portal pane to show content reliably. It appears the pane will never show content if it happens to be minimized when IntelliJ starts. Also, I've found the pane content vanishes if the pane position is moved, using the cog menu > Move To options. I'm using IntelliJ Ultimate 2021.3.3 with Portal 0.22.1. Is this a known issue?

steffan18:03:22

I've discovered this issue is affecting IntelliJ running in WSL 2, but not IntelliJ running natively in Windows 10. I can't run Windows 11 so I don't know if works when running in WSLg.

djblue18:03:44

Interesting, I haven't tried this configuration :thinking_face:

steffan18:03:23

Once the pane content vanishes, it's gone for good until I restart IntelliJ.

djblue22:03:14

For those using #nbb, portal.client.node remote client should work in the next release 🙌

👏 2
djblue22:03:59

(require '[portal.client.node :as p])
(def submit (partial p/submit {:port ...}))
(add-tap #'submit)
Is all the code you need, not sure how to get the code on the classpath yet :thinking_face:

borkdude08:03:06

This seems to work!

$ clj -Sdeps '{:deps {djblue/portal {:git/url "" :git/sha "1009dd87a8975eca0d3724cd8bf957ac94712b6a"}}}' -Spath > .classpath
$ nbb --classpath $(cat .classpath) -e "(require '[portal.client.node])"

awesome 1