Fork me on GitHub
#portal
<
2021-11-08
>
djblue03:11:59

I haven't published the intellij plugin just yet as I would like some folks to try it out first before it's available in the plugin repository. If you are an intellij user, you can pull down the https://github.com/djblue/portal/releases/download/0.17.0/portal-extension-intellij-0.17.0.zip and install it manually from disk. Feedback welcome!

djblue03:11:35

Another major highlight is multi-select which enables n-arity commands. To perform a multil-select, hold down cmd on osx and click multiple values (haven't tried this on windows yet). You can now select any two items and diff them directly via lambdaisland.deep-diff2/diff! This also works for any user supplied commands.

djblue03:11:34

To launch the UI in intellij, do (def idea (p/open {:launcher :intellij})) . Documentation will be updated soon.

markaddleman18:11:57

I have installed the intellij plugin from the zip and I have confirmed the plugin is active but I don't see any new viewer. How can I get to the portal viewer?

markaddleman18:11:23

That was it. My clojure project is a directory within a larger IntelliJ project.

markaddleman18:11:47

When I create a new IntelliJ project pointing to the correct subdirectory, I have the Portal tool viewer.

awesome 1
djblue19:11:50

I could remove this limitation, just thought most people would be annoyed to see the portal tool window if it wasn't a clojure project.

wilkerlucio19:11:32

would be nice to have the option, in my case I also have a problem with multiple modules inside

wilkerlucio19:11:34

altough I just tried in one that's a simple clojure project, I still can't see the portal tool window

djblue19:11:08

Is the repl process running inside the project?

markaddleman19:11:02

> I could remove this limitation, just thought most people would be annoyed to see the portal tool window if it wasn't a clojure project. My opinion: If you don't want to see the portal viewer, simply close it in IntelliJ. I suspect the isApplicable guard will be more annoying than useful

๐Ÿ‘ 1
djblue19:11:39

@U2845S9KL agreed ๐Ÿ’ฏ

๐Ÿ‘ 1
wilkerlucio20:11:31

yes, REPL running inside the project

1
wilkerlucio20:11:50

is this something I have to do myself? Im on latest stable intellij, and didn't remember changing anything related to JCEF

wilkerlucio21:11:49

I got some errors in the log

wilkerlucio21:11:51

com.intellij.diagnostic.PluginException: Cannot create class portal.extensions.intellij.Factory (classloader=PluginClassLoader(plugin=PluginDescriptor(name=portal, id=djblue.portal-extension-intellij, descriptorPath=plugin.xml, path=~/Library/Application Support/JetBrains/IntelliJIdea2021.2/plugins/portal-extension-intellij-0.17.0.jar, version=0.17.0, package=null), packagePrefix=null, instanceId=5, state=active))
	at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:870)
	at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:887)
	at com.intellij.openapi.wm.ToolWindowEP.getToolWindowFactory(ToolWindowEP.java:129)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl$$special$$inlined$processDescriptors$1.accept(ToolWindowManagerImpl.kt:2317)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl$$special$$inlined$processDescriptors$1.accept(ToolWindowManagerImpl.kt:88)
	at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processWithPluginDescriptor(ExtensionPointImpl.java:293)
	at com.intellij.openapi.extensions.ExtensionPointName.processWithPluginDescriptor(ExtensionPointName.java:156)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.<init>(ToolWindowManagerImpl.kt:2362)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at com.intellij.serviceContainer.ConstructorInjectionKt.instantiateUsingPicoContainer(constructorInjection.kt:52)
	at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClassWithConstructorInjection(ComponentManagerImpl.kt:877)
	at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:48)
	at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:36)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:113)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:67)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstance$default(BaseComponentAdapter.kt:60)
	at com.intellij.serviceContainer.ComponentManagerImpl.instantiateService(ComponentManagerImpl.kt:1084)
	at com.intellij.serviceContainer.ComponentManagerImpl$preloadServices$1.invoke(ComponentManagerImpl.kt:1056)
	at com.intellij.serviceContainer.ComponentManagerImpl$preloadServices$1.run(ComponentManagerImpl.kt:58)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:408)
	at java.base/java.util.concurrent.ForkJoinTask.invokeAll(ForkJoinTask.java:845)
	at com.intellij.serviceContainer.ComponentManagerImpl$preloadServices$2.run(ComponentManagerImpl.kt:1071)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1728)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.NoClassDefFoundError: clojure/lang/Var
	at portal.extensions.intellij.Factory.<clinit>(Unknown Source)
	at java.base/jdk.internal.misc.Unsafe.allocateInstance(Native Method)
	at java.base/java.lang.invoke.DirectMethodHandle.allocateInstance(DirectMethodHandle.java:482)
	at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:830)
	... 33 more
Caused by: java.lang.ClassNotFoundException: clojure.lang.Var PluginClassLoader(plugin=PluginDescriptor(name=portal, id=djblue.portal-extension-intellij, descriptorPath=plugin.xml, path=~/Library/Application Support/JetBrains/IntelliJIdea2021.2/plugins/portal-extension-intellij-0.17.0.jar, version=0.17.0, package=null), packagePrefix=null, instanceId=5, state=active)
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:235)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 37 more

djblue22:11:45

That's an interesting stacktrace, not sure why Caused by: java.lang.NoClassDefFoundError: clojure/lang/Var would happen, especially since the clojure jar is part of the distribution zip :thinking_face:

djblue23:11:16

@U066U8JQJ, I can reproduce if I crack open the zip and install lib/portal-extension-intellij-0.17.0.jar. Is that how you are installing the plugin? If so, try installing the .zip archive directly.

wilkerlucio00:11:46

ah facepalm that is it

wilkerlucio00:11:49

trying to reinstall now

wilkerlucio00:11:40

working, its awesome, thank you very much!

โค๏ธ 1
seancorfield03:11:23

@djblue The README says:

;; optional json support
  cheshire/cheshire {:mvn/version "5.10.0"}
Is that still true, given the adoption of data.json in 0.16.3?

djblue03:11:35

You are correct, I forgot to update the readme after the switch. Although I don't know why I have json listed as an optional dependency since it's a direct dependency. I should delete that entirely. Sorry for the confusion.

djblue03:11:42

I think that was when json was an optional dep and I was using transit as the serialization format. Now json is directly required for portal to function.

seancorfield04:11:09

The yaml stuff is still optional tho' right?

๐Ÿ‘ 1
djblue04:11:56

Yeah, I never added that as a dep to portal. Although it would work directly in bb since it's included by default.

seancorfield04:11:45

I used to have it in my :rebl alias but I've a feeling it's in our dep tree at work due to something else...

๐Ÿ’ฏ 1
djblue04:11:47

Transitive deps are always fun ๐Ÿ’ฏ

seancorfield04:11:18

...hmm, nope, apparently. clojure -Stree -A:dev:everything has nearly 1,000 lines though... ๐Ÿ‘€

djblue04:11:53

๐Ÿ˜ฒ

djblue04:11:07

Also to be fair my work repo has 451 lines for our deps tree ๐Ÿ˜†

seancorfield04:11:32

$ clojure -X:deps list :aliases '[:dev :everything]'|wc
    331     662   16314
using the latest CLI.

djblue04:11:01

What is that computing exactly? All the deps for all the aliases?

seancorfield04:11:57

It's the unique, sorted list of final, selected dependencies.

seancorfield04:11:28

But it also includes local deps which is a bit misleading in our case...

djblue04:11:46

Is the output lines, words, chars?

seancorfield04:11:33

So we have 97 local deps. So that's 234 external deps.

djblue04:11:30

When I do clj -Stree -A:dev:test:nrepl:cljs-deps | sort | uniq | wc , I get 382 1221 16027

djblue04:11:49

So we might be "winning" ๐Ÿ˜

seancorfield04:11:20

Production deps:

$ clojure -Stree -A:dev:everything|sort|uniq|wc
    539    1675   29848
With test/dev deps as well:
$ clojure -Stree -A:dev:everything:test:runner:build:poly|sort|uniq|wc
WARNING: Use of :main-opts with -A is deprecated. Use -M instead.
    783    2477   44747

๐Ÿ˜ฒ 1
seancorfield04:11:28

(but that's a 120K line code base)

๐Ÿ‘ 1
seancorfield04:11:45

With Polylith, there's typically no "core" deps. Everything comes it with :dev for the "default" project. :everything is the core deps for our legacy code (that hasn't migrated to Polylith yet).

djblue04:11:35

Even with the new extensions and tooling, portal remains 99.4% clojure. It's kinda nuts all the places clojure can reach!

๐Ÿ’ฏ 2
Ben Sless04:11:38

Question regarding implementation details, does portal keep references to all sent taps or does it eventually release them? Paranoid about eventual memory leaks

djblue04:11:23

> NOTE: portal will keep objects from being garbage collected until they are cleared from the UI.

djblue04:11:36

You are correct to be paranoid ๐Ÿ˜‚

Ben Sless04:11:23

Have you considered adding a default configurable upper limit?

seancorfield04:11:59

It's partly why I have a hot key bound to clearing the Portal UI ๐Ÿ™‚

โ˜๏ธ 1
metal 1
Ben Sless04:11:37

There's probably some human upper limit which can be reasonably set

djblue04:11:52

The problem is that reasonable is a relative value (wide vs deep references for example). My expectation is that most people are using portal during development where hanging onto values a little longer isn't an issue, especially because clearing values is pretty easy.

djblue04:11:44

I guess my question would be, what are some issues you have experienced with portal?

Ben Sless04:11:24

True. It's just a consideration I have because I want to contribute to cider tap support for the inspector

seancorfield04:11:30

My REPLs run for weeks and weeks and I don't clear Portal's UI very often TBH. I don't think it's something to really worry about. My default eval hot keys all tap> values into Portal and that's how I work day-in, day-out...

1
djblue04:11:31

Interesting. Currently with portal, as soon as you add-tap the p/submit function, portal begins collecting values. Portal could easily drop values if no UI is currently connected :thinking_face:

imre09:11:37

A configurable upper limit could still be useful, perhaps turned off by default

seancorfield04:11:29

I've seen a few people ask for an emacs integration -- does emacs have a built-in webview these days? I'm assuming not in the terminal version but maybe in some of the platform-integrated versions?

djblue04:11:54

I think there are some native plugins but they aren't the default so not as easy of a target as the other portal extensions.