This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-29
Channels
- # babashka (64)
- # beginners (60)
- # calva (10)
- # circleci (3)
- # clj-kondo (62)
- # cljdoc (6)
- # clojars (2)
- # clojure (152)
- # clojure-europe (19)
- # clojure-nl (3)
- # clojure-uk (18)
- # clojurescript (50)
- # clojureverse-ops (12)
- # core-async (21)
- # cursive (6)
- # data-science (1)
- # datomic (17)
- # events (14)
- # fulcro (64)
- # graalvm (20)
- # graphql (5)
- # honeysql (14)
- # jackdaw (3)
- # jobs (1)
- # jobs-discuss (22)
- # kaocha (2)
- # lsp (9)
- # luminus (8)
- # malli (30)
- # meander (31)
- # other-languages (1)
- # polylith (8)
- # re-frame (15)
- # shadow-cljs (85)
- # specter (2)
- # sql (11)
- # tools-deps (56)
- # vim (39)
- # vscode (7)
- # xtdb (16)
I'm trying to get a browser repl connected to a vscode webview that runs shadow-cljs source
I only have superficial knowledge of how the vscode extension scaffolding works, but it appears that it wants to load the js payload from a dynamically generated UUID. This is similar / same to how chrome/ff extensions work with some hashified resource locator inside the browser's own resource space. However, the UUID application also seems to rewrite the browser repl websocket server URL
in other words when you set up a browser repl, an injected <ws://localhost:9630/api/remote-relay>... becomes <ws://some-long-uuid-string:9630/api/remote-relay>...
Got it. The answer is to explicitly set :devtools-url
inside the :devtools
map for the shadow-cljs build configuration. When not set, it will derive the URL from a dynamic function call (`shadow.cljs.devtools.client.env.get_ws_relay_url`). I didn't look deeper but I am guessing the dynamic URL picks up host (in this case, vs-code-wrapped) information for the websocket server address, and adding the explicit setting probably forces it to be a string constant
I hope this setup will allow faster vs code extension development. Set up the main extension instance to connect via cljs repl (https://github.com/Saikyun/cljs-vscode-extension-hello-world is a good guide). Then for webviews, with the configuration above, you can set up hot reload / browser-repl.