This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-28
Channels
- # announcements (11)
- # aws (2)
- # babashka (35)
- # beginners (173)
- # calva (3)
- # chlorine-clover (2)
- # cider (17)
- # clara (2)
- # clj-kondo (28)
- # cljs-dev (11)
- # cljsrn (53)
- # clojure (178)
- # clojure-argentina (1)
- # clojure-europe (12)
- # clojure-germany (5)
- # clojure-italy (4)
- # clojure-nl (5)
- # clojure-spec (25)
- # clojure-uk (88)
- # clojurescript (109)
- # conjure (34)
- # cursive (2)
- # data-science (35)
- # datomic (15)
- # emacs (6)
- # events (1)
- # fulcro (28)
- # graphql (15)
- # helix (21)
- # hoplon (7)
- # jobs (4)
- # jobs-discuss (1)
- # joker (15)
- # lambdaisland (1)
- # lein-figwheel (4)
- # local-first-clojure (1)
- # malli (8)
- # meander (17)
- # off-topic (33)
- # parinfer (2)
- # rdf (16)
- # re-frame (3)
- # reagent (21)
- # reitit (14)
- # remote-jobs (5)
- # ring (8)
- # rum (1)
- # shadow-cljs (184)
- # sql (2)
- # testing (1)
- # tools-deps (23)
What is best way to create Evil Mode bindings of Cider keys?
so I'm doing an annoyingly complex dual build equivalent to
clj -m figwheel.main -bb serviceworker -b view
and the only way I can figure out how to do that in CIDER is cider-jack-in
then inject
(do (use 'figwheel.main.api)
(start {} "view" "serviceworker")
(cljs-repl "view"))
is there away to avoid typing that do
block into the REPL every time?I think this is what you’re looking for: https://docs.cider.mx/cider/0.24/cljs/configuration.html#_defining_custom_clojurescript_repl_types
those are indeed the droids I'm looking for, thank you my good sir 🎩
I have two lein profiles that I use often while connecting to the repl using this function
(defun cider-jack-in-with-profile ()
(interactive)
(letrec ((profile (read-string "Enter profile name: "))
(lein-params (concat "with-profile +" profile " repl :headless")))
(message "lein-params set to: %s" lein-params)
(set-variable 'cider-lein-parameters lein-params)
(cider-jack-in '())))
lets say Im using profile X, and now I want to connect with profile Y, whats the best way to the switch?
is there a cider-jack-out where I can jack-in again with a new profile?What's the proper workflow in cases when you have an error after you restart/reload your app using mount? An example:
user> (restart)
#error {
:cause "Unable to resolve symbol: account-database in this context"
:via
[{:type clojure.lang.Compiler$CompilerException
:message "Syntax error compiling at (app/model/session.clj:55:39)."
:data #:clojure.error{:phase :compile-syntax-check, :line 55, :column 39, :source "app/model/session.clj"}
:at [clojure.lang.Compiler analyze "Compiler.java" 6808]}
{:type java.lang.RuntimeException
:message "Unable to resolve symbol: account-database in this context"
:at [clojure.lang.Util runtimeException "Util.java" 221]}]
:trace
[[clojure.lang.Util runtimeException "Util.java" 221]
Reloadable Clojure REPL
user> (restart)
Syntax error compiling at (*cider-repl Projects/pollcro:localhost:43993(clj)*:597:7).
Unable to resolve symbol: restart in this context
user> (start)
Syntax error compiling at (*cider-repl Projects/pollcro:localhost:43993(clj)*:600:7).
Unable to resolve symbol: start in this context
After fixing an error, I can not (restart) this reply anymore due to the following error: > Unable to resolve symbol: restart in this context Is it always like this or am I doing something wrong with my REPL workflow? As a workaround, I cider-quit my REPL session and start it again but that's very annoying. It seems I can use mount/start after fixing an error:
user> (mount/start)
{:started
["#'app.server-components.config/config"
"#'app.model.database/pool"
"#'app.model.mock-database/conn"]}
But it completely loses my user namespace scope, REPL doesn't see any of its methods + I can't send user namespace to repl because of the following error:
Syntax error compiling at (app/server_components/pathom.clj:1:1).
namespace 'app.model.session' not found
("src/main" "src/dev" "src/test")#function[expound.alpha/printer]nil#'user/start#'user/stop#'user/restartnil
That's what my https://github.com/fulcrologic/fulcro-template/blob/master/src/dev/user.clj looks like:
(ns user
(:require
[clojure.tools.namespace.repl :as tools-ns :refer [set-refresh-dirs]]
[expound.alpha :as expound]
[clojure.spec.alpha :as s]
[mount.core :as mount]
;; this is the top-level dependent component...mount will find the rest via ns requires
[app.server-components.http-server :refer [http-server]]))
;; ==================== SERVER ====================
(set-refresh-dirs "src/main" "src/dev" "src/test")
;; Change the default output of spec to be more readable
(alter-var-root #'s/*explain-out* (constantly expound/printer))
(defn start
"Start the web server"
[] (mount/start))
(defn stop
"Stop the web server"
[] (mount/stop))
(defn restart
"Stop, reload code, and restart the server. If there is a compile error, use:
(tools-ns/refresh)
to recompile, and then use `start` once things are good."
[]
(stop)
(tools-ns/refresh :after 'user/start))
just checked it - yes it works the same way if I just run it as standalone repl via clojure -A:dev -J-Dtrace -J-Dghostwheel.enabled=true
ah ok. so i'm not sure there's much CIDER can do here. seems your code is nuking vars so CIDER can't really rescue you
Is there a way to define a custom function in the shadow.repl namespace to run automatically, i.e., shadow/watch for a couple of profiles + shadow/repl for a profile? Right now, in my Luminus template, when I start the repl, the following command is run:
/usr/local/bin/npx shadow-cljs -d nrepl:0.6.0 -d refactor-nrepl:2.5.0-SNAPSHOT -d cider/cider-nrepl:0.23.0 server
Given this, where do I specify a function to run automatically when the repl starts?
I want to automate this behavior:
1. I connect to the shadow repl using cider-jack-in.
2. This shows the shadow.user> repl.
3. At the prompt I run: (do (shadow/watch :app) (shadow/watch :workspaces) (shadow/repl :workspaces)) to watch these two profiles and run the repl for one of them.
How do I run this do automatically every time I connect with shadow?