Fork me on GitHub
#portal
<
2021-12-17
>
seancorfield04:12:36

Sounds great! I look forward to enough of an example to actually try it out 🙂

Lukas Domagala10:12:14

a minimal example would be this:

(launcher/eval-str (str '(ns mine
                             (:require
                                       [portal.ui.inspector :as inspector]))
                          '(defn register-viewer! [viewer-spec]
                             (swap! inspector/viewers conj viewer-spec))
                          '(register-viewer! {:predicate string?
                                              :component (fn [val]
                                                           [:portal.ui.styled/div
                                                            {:title "Time"
                                                             :style
                                                             {:display :flex
                                                              :align-items :center}}
                                                            val])
                                              :name :portal.viewer/testing5})
                          '1))
the ’1 at the end is just so you don’t blow up transit with the return value.

seancorfield17:12:34

Ah, an explicit eval call. And how to reach from sci into the VS Code APIs I wonder?

Lukas Domagala18:12:20

you can’t since that ns is not passed to sci

seancorfield18:12:06

My main interest in customization here is being able to have Portal invoke commands in the host editor (well, VS Code, but I suspect the IntelliJ folks would like this too).

Lukas Domagala15:12:28

If @U1G869VNV is busy I can try to find some time for a quick prototype, although I've only build custom versions of the standalone ui till now

borkdude13:12:55

You can pass the entire JS world to SCI using {:classes {'js goog/global :allow :all}}

borkdude13:12:28

Then you should be able to call into any API using (js/vscode.api.foobar)