Fork me on GitHub
#cider
<
2022-06-17
>
lilactown18:06:59

when I run cider-jack-in-cljs, and using the built in browser REPL, is there a way to tell it to open a different browser (or give me a chance to copy URL to the clipboard) instead of opening the default browser

lilactown18:06:23

by default I use safari, but want to REPL in chrome rn 😅

Derek18:06:53

I’ve been using https://www.choosyosx.com/ for this, so would love a simpler solution

lilactown18:06:29

I think we could add a prompt

lilactown18:06:44

in cider.el

(browser "(do (require 'cljs.repl.browser) (cider.piggieback/cljs-repl (cljs.repl.browser/repl-env)))")
 
we can pass {:launch-browser false} to the repl-env call there

Derek18:06:52

Since it’s just calling browse-url, I think there’s some ability to customize a var there

lilactown19:06:31

here's what I added to my .spacemacs config

(defun spacemacs/user-config ()
  ,,,
  (with-eval-after-load 'cider
    (cider-register-cljs-repl-type
     'browser-no-open
     "(do (require 'cljs.repl.browser) (cider.piggieback/cljs-repl (cljs.repl.browser/repl-env :launch-browser false)))")))

lilactown19:06:07

now I can run cider-jack-in-cljs and select browser-no-open as the REPL type

lilactown19:06:34

after the nREPL server is launched and connected, the REPL buffer has the URL in it that I can copy paste into Chrome

lilactown19:06:48

suffices for my needs 🙂

dpsutton19:06:48

there’s also

(defcustom cider-offer-to-open-cljs-app-in-browser t
  "When nil, do not offer to open ClojureScript apps in a browser on connect."
  :type 'boolean
  :safe #'booleanp
  :version '(cider . "0.15.0"))
not sure if you’re also hitting that?

lilactown20:06:25

i don't think that's used for the browser REPL

lilactown20:06:07

you can see the snippet i pasted above, (repl-env) is called with no arguments meaning that it is actually CLJS that opens the browser, not CIDER

lilactown20:06:17

and there's no parameterization of it

lilactown20:06:54

i think it would be great for CIDER to add the prompt to the browser REPL type, but my elisp-fu is quite weak

bozhidar08:06:01

@U4YGF4NGM File some ticket about this and we can make it happen.

gratitude 1
lilactown19:06:31

here's what I added to my .spacemacs config

(defun spacemacs/user-config ()
  ,,,
  (with-eval-after-load 'cider
    (cider-register-cljs-repl-type
     'browser-no-open
     "(do (require 'cljs.repl.browser) (cider.piggieback/cljs-repl (cljs.repl.browser/repl-env :launch-browser false)))")))