djblue / portal

A clojure tool to navigate through your data.
https://djblue.github.io/portal/
MIT License
872 stars 81 forks source link

IntelliJ extension fails on nil theme values #221

Closed rads closed 4 months ago

rads commented 4 months ago

I noticed my IntelliJ plugin has been broken for a while and I finally figured out what it was. Apparently my theme override is not providing all required color values. The Portal UI chokes on an re-matches call when it receives a color value as nil.

I had to add some error handlers to the plugin to be able to see the error since it was happening inside the embedded JBCefBrowser. The logs are located at ~/Library/Logs/JetBrains/IntelliJIdea2024.1/idea.log.

I'll follow up with a PR shortly to fix this by using the default theme as a fallback.

INFO - #portal.extensions.intellij.factory.PortalLogger - Request: /open
INFO - #portal.extensions.intellij.factory.PortalLogger - Opening http://localhost:56324?474c0560-ed2e-4e02-93bf-7df1af49c894
INFO - #portal.extensions.intellij.factory.PortalLogger - Starting loading
INFO - #portal.extensions.intellij.factory.PortalLogger - Patching options
INFO - #portal.extensions.intellij.factory.PortalLogger - Running portal.ui.options.patch("{:theme :portal.extensions.intellij.factory/theme, :themes {:portal.extensions.intel
ring \"rgb(42,161,152)\", :portal.colors/keyword \"rgb(108,113,196)\", :portal.colors/exception \"rgb(212,100,45)\", :font-size 18, :portal.colors/text \"rgb(101,123,131)\", :
237,220)\", :portal.colors/boolean \"rgb(108,113,196)\", :portal.colors/tag nil, :portal.colors/uri \"rgb(62,128,179)\", :portal.colors/namespace \"rgb(133,153,0)\", :portal.c
portal.colors/package nil, :portal.colors/border \"rgb(227,224,206)\", :portal.colors/symbol \"rgb(101,123,131)\", :portal.colors/diff-remove \"rgb(212,100,45)\", :portal.colo
l.colors/background \"rgb(253,246,227)\", :font-family \"\\\"Office Code Pro\\\", monospace\"}}}")
INFO - STDERR - clojure.lang.ExceptionInfo: JavaScript error: re-matches must match against a string. {}
INFO - STDERR -     at portal.extensions.intellij.factory$setup_java_error_handler$fn__470.invoke(factory.clj:100)
INFO - STDERR -     at portal.extensions.intellij.factory$as_function$reify__465.apply(factory.clj:96)
INFO - STDERR -     at com.intellij.ui.jcef.JBCefJSQuery$1.onQuery(JBCefJSQuery.java:123)
rads commented 4 months ago

I realized I pasted the wrong error from my logs. It's fixed now.