Fork me on GitHub
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"}


@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:


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.


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
├── 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 👍


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

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.


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

👏 1

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


Not at all, let me put the library on github


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)


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


then require it in your file


and then, for instrumentation, you should use:

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


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


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 ()
   "#(portal.malli.visualizer/check->portal (mi/check {:filters [(mi/-filter-var #{(resolve (second %))})]}))"))

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


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

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

🙌 1

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


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)


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?


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.


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


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


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

👏 2

(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:


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