cider

A channel dedicated to the Clojure Interactive Development Environment that Rocks (aka CIDER). :cider:
2021-02-04T03:20:05.152400Z

Every time I paste something in, my entire file is auto-indented. Does anyone know how to turn that off? I have aggressive-indent-mode turned off.

2021-02-04T03:21:05.152500Z

If this isn't a cider thing, let me know and I'll ask over in #emacs.

dpsutton 2021-02-04T03:53:36.153500Z

Not aware of anything in cider that would do that

1👍1
bozhidar 2021-02-04T07:11:58.153900Z

Might be some advice to reformat on pasting.

bozhidar 2021-02-04T07:12:12.154100Z

It's certainly not coming from CIDER, though.

oly 2021-02-04T11:35:11.155500Z

is there a way to jump to core library code in cider or library code ?

oly 2021-02-04T11:35:45.156Z

so if my cursor is on db/query I want to peak the fn to see what its doing

tvirolai 2021-02-04T11:48:20.156500Z

Sure, cider-find-var does that.

oly 2021-02-04T12:23:56.157200Z

ah cheers exactly what i want, who would have thought find var to find a function 😛

borkdude 2021-02-04T12:28:16.157500Z

Bound to M-. usually

oly 2021-02-04T12:29:27.158600Z

yeah I just added it to a hydra under ? and labelled it "Show src" else i will be back asking again in a few months 🙂

craftybones 2021-02-04T12:57:57.159400Z

Hello. I’m facing a problem similar to the one in this ticket: https://github.com/clojure-emacs/cider/issues/2237

craftybones 2021-02-04T12:58:36.159900Z

However, I’m on

;; CIDER 0.25.0snapshot (package: 20200602.710), nREPL 0.7.0
;; Clojure 1.10.1, Java 14.0.2

craftybones 2021-02-04T12:58:43.160100Z

I’m using Spacemacs

craftybones 2021-02-04T13:00:57.160600Z

I evaluate anything that throws an exception and the dialog shows up 1 second later, maybe more

craftybones 2021-02-04T13:01:11.160900Z

I’ve accidentally ended up exiting emacs a few times as a consequence 🙂

craftybones 2021-02-04T13:02:32.161500Z

Does anybody have a suggestion other than upgrading packages? That is a last resort…

craftybones 2021-02-04T13:23:16.162200Z

Ah, alright, Ignore, I gave up and upgraded, the Cider version certainly seemed old. Seems to have fixed it

Lukas 2021-02-04T20:55:35.163600Z

Hello, I use emacs/cider and have a clojurescript project build with shadow cljs. I connected to the nrepl server, but I'm not able to send s-expressions to the repl with C-c C-e like I normally do. Can anybody help me with this?

dpsutton 2021-02-04T20:58:52.163900Z

what happens when you hit C-c C-e?

Lukas 2021-02-04T20:59:49.164200Z

nothing it just hangs

Lukas 2021-02-04T21:00:40.164500Z

Lukas 2021-02-04T21:01:01.165Z

I use doom emacs if this helps

Lukas 2021-02-04T21:01:37.166100Z

just to add I'm a emacs noob 😇

dpsutton 2021-02-04T21:01:38.166200Z

is this a webapp? If so, evaluate (js/alert "HI") to prove you're actually in a cljs repl

Lukas 2021-02-04T21:03:19.166500Z

this works after i switch the namespace (shadow.cljs.devtools.api/repl :app)

Lukas 2021-02-04T21:03:39.166900Z

but C-c C-e still does nothing

dpsutton 2021-02-04T21:04:20.167300Z

how did you connect? cider-connect-cljs and then chose shadow-select?

Lukas 2021-02-04T21:05:28.167700Z

cider-connect-cljs and then select host +port

dpsutton 2021-02-04T21:06:04.168100Z

and how did you start shadow?

Lukas 2021-02-04T21:06:33.168400Z

shadow-cljs watch app

dpsutton 2021-02-04T21:07:05.169100Z

and do you have cider-nrepl in your deps?

dpsutton 2021-02-04T21:07:18.169400Z

also, is this a :deps true type project?

Lukas 2021-02-04T21:07:59.169800Z

no but i have a deps project in the same folder

Lukas 2021-02-04T21:09:13.170100Z

i also get some errors on shadow start

[:failed-to-compare "^17.0.1" "17.0.1" #error {
 :cause "Cannot invoke \"Object.getClass()\" because \"target\" is null"
 :via
 [{:type java.lang.NullPointerException
   :message "Cannot invoke \"Object.getClass()\" because \"target\" is null"
   :at [clojure.lang.Reflector invokeInstanceMethod "Reflector.java" 97]}]
 :trace
 [[clojure.lang.Reflector invokeInstanceMethod "Reflector.java" 97]
  [shadow.cljs.devtools.server.npm_deps$make_engine invokeStatic "npm_deps.clj" 39]
  [shadow.cljs.devtools.server.npm_deps$make_engine invoke "npm_deps.clj" 32]
  [shadow.cljs.devtools.server.npm_deps$fn__15774$fn__15775 invoke "npm_deps.clj" 46]
  [clojure.lang.Delay deref "Delay.java" 42]
  [clojure.core$deref invokeStatic "core.clj" 2320]
  [clojure.core$deref invoke "core.clj" 2306]
  [shadow.cljs.devtools.server.npm_deps$fn__15774$fn__15777 invoke "npm_deps.clj" 52]
  [shadow.cljs.devtools.server.npm_deps$is_installed_QMARK_ invokeStatic "npm_deps.clj" 219]
  [shadow.cljs.devtools.server.npm_deps$is_installed_QMARK_ invoke "npm_deps.clj" 213]
  [shadow.cljs.devtools.server.npm_deps$main$fn__15867 invoke "npm_deps.clj" 239]
  [clojure.core$complement$fn__5669 invoke "core.clj" 1441]
  [clojure.core$filter$fn__5893 invoke "core.clj" 2821]
  [clojure.lang.LazySeq sval "LazySeq.java" 42]
  [clojure.lang.LazySeq seq "LazySeq.java" 51]
  [clojure.lang.RT seq "RT.java" 535]
  [clojure.core$seq__5402 invokeStatic "core.clj" 137]
  [clojure.core$seq__5402 invoke "core.clj" 137]
  [shadow.cljs.devtools.server.npm_deps$main invokeStatic "npm_deps.clj" 241]
  [shadow.cljs.devtools.server.npm_deps$main invoke "npm_deps.clj" 228]
  [shadow.cljs.devtools.cli_actual$main invokeStatic "cli_actual.clj" 141]
  [shadow.cljs.devtools.cli_actual$main doInvoke "cli_actual.clj" 132]
  [clojure.lang.RestFn applyTo "RestFn.java" 137]
  [clojure.core$apply invokeStatic "core.clj" 669]
  [clojure.core$apply invoke "core.clj" 660]
  [shadow.cljs.devtools.cli_actual$_main invokeStatic "cli_actual.clj" 219]
  [shadow.cljs.devtools.cli_actual$_main doInvoke "cli_actual.clj" 217]
  [clojure.lang.RestFn applyTo "RestFn.java" 137]
  [clojure.lang.Var applyTo "Var.java" 705]
  [clojure.core$apply invokeStatic "core.clj" 665]
  [clojure.core$apply invoke "core.clj" 660]
  [shadow.cljs.devtools.cli$_main invokeStatic "cli.clj" 75]
  [shadow.cljs.devtools.cli$_main doInvoke "cli.clj" 67]
  [clojure.lang.RestFn applyTo "RestFn.java" 137]
  [clojure.lang.Var applyTo "Var.java" 705]
  [clojure.core$apply invokeStatic "core.clj" 665]
  [clojure.main$main_opt invokeStatic "main.clj" 514]
  [clojure.main$main_opt invoke "main.clj" 510]
  [clojure.main$main invokeStatic "main.clj" 664]
  [clojure.main$main doInvoke "main.clj" 616]
  [clojure.lang.RestFn applyTo "RestFn.java" 137]
  [clojure.lang.Var applyTo "Var.java" 705]
  [clojure.main main "main.java" 40]]}]
shadow-cljs - HTTP server available at <http://localhost:8000>
shadow-cljs - server version: 2.9.10 running at <http://localhost:9630>
shadow-cljs - nREPL server started on port 42499
shadow-cljs - watching build :app

Lukas 2021-02-04T21:09:38.170300Z

my shadow-cljs.edn

;; shadow-cljs configuration
{:source-paths
 ["src"]

 :dependencies
 [[reagent "1.0.0"]
  [cljs-ajax "0.8.1"]
  [re-frame "1.1.2"]]

 :builds
 {:app
  {:target :browser
   :output-dir "public/js"
   :asset-path "/js"

   :modules
   {:main
    {:init-fn <http://lhrb.frontend.app/init|lhrb.frontend.app/init>
     :entries [<http://lhrb.frontend.app|lhrb.frontend.app>]}}

   :devtools
   {:http-root "public"
    :http-port 8000}
   :nrepl {:port 9000}}}}

Lukas 2021-02-04T21:11:28.170500Z

👆there is the :nrepl in the wrong position

Lukas 2021-02-04T21:11:37.170700Z

i tried some things before i ask

Lukas 2021-02-04T21:11:41.170900Z

;; shadow-cljs configuration
{:source-paths
 ["src"]

 :dependencies
 [[reagent "1.0.0"]
  [cljs-ajax "0.8.1"]
  [re-frame "1.1.2"]]

 :builds
 {:app
  {:target :browser
   :output-dir "public/js"
   :asset-path "/js"

   :modules
   {:main
    {:init-fn <http://lhrb.frontend.app/init|lhrb.frontend.app/init>
     :entries [<http://lhrb.frontend.app|lhrb.frontend.app>]}}

   :devtools
   {:http-root "public"
    :http-port 8000}}}

 :nrepl {:port 9000}}

dpsutton 2021-02-04T21:12:35.171400Z

so cider will start shadow up like this:

npx shadow-cljs -d nrepl/nrepl:0.8.3 -d cider/cider-nrepl:0.25.8 server
and then in the repl after connecting:
shadow.user&gt; (require '[shadow.cljs.devtools.api :as shadow])
nil
shadow.user&gt; (shadow/watch :app)
[:app] Configuring build.
[:app] Compiling ...
[:app] Build completed. (174 files, 0 compiled, 0 warnings, 3.87s)
:watching
shadow.user&gt; (js/alert "hi")
Syntax error compiling at (*cider-repl clojure/asg-ignite-app:localhost:58111(clj)*:17:14).
No such namespace: js
shadow.user&gt; (shadow/nrepl-select :app)
To quit, type: :cljs/quit
[:selected :app]
cljs.user&gt; (js/alert "hi")
nil
cljs.user&gt; 

Lukas 2021-02-04T21:14:24.171500Z

i try this npx shadow-cljs -d nrepl/nrepl:0.8.3 -d cider/cider-nrepl:0.25.8 server

Lukas 2021-02-04T21:15:33.172100Z

Okay now cider ask me to select a clojure repl type

Lukas 2021-02-04T21:15:53.172600Z

shadow or shadow-select?

dpsutton 2021-02-04T21:16:05.173Z

i did cider-connect (not the cljs one). but try shadow-select and then choose your build

Lukas 2021-02-04T21:18:41.173300Z

You can mute this warning by changing cljr-suppress-middleware-warnings.shadow.user&gt; 
shadow.user&gt; (require '[shadow.cljs.devtools.api :as shadow])
;; =&gt; nil
shadow.user&gt; (shadow/watch :app)
[:app] Configuring build.
[:app] Compiling ...
[:app] Build completed. (216 files, 215 compiled, 0 warnings, 38.84s)
;; =&gt; :watching
shadow.user&gt; (js/alert "hi")
Syntax error compiling at (*cider-repl workspace/listshare:localhost:9000(clj)*:26:14).
No such namespace: js

Lukas 2021-02-04T21:19:10.173900Z

But I guess I have to change the namespace again?

dpsutton 2021-02-04T21:19:19.174100Z

no you have to enter the cljs repl

dpsutton 2021-02-04T21:19:22.174300Z

shadow.user&gt; (shadow/nrepl-select :app)
To quit, type: :cljs/quit
[:selected :app]
cljs.user&gt; (js/alert "hi")
nil

dpsutton 2021-02-04T21:19:48.174900Z

so you're telling shadow to watch :app (compile the cljs files and recompile if they change) and then select that repl (nrepl-select :app)

Lukas 2021-02-04T21:20:39.175300Z

yes that worked

Lukas 2021-02-04T21:20:48.175700Z

and I also can evaluate now

Lukas 2021-02-04T21:21:06.176Z

Thanks a lot!!!

dpsutton 2021-02-04T21:21:13.176200Z

glad you got it working!

dpsutton 2021-02-04T21:21:16.176400Z

and my pleasure

Lukas 2021-02-04T21:23:15.177800Z

Awesome. Took me a lot of time to finally come here and ask. You are a great person just helping randoms on the internet 🙏

dpsutton 2021-02-04T21:24:30.178700Z

always pop in to ask questions. I had forgotten how this stuff worked and it was helpful to go through it with you. And i was similarly confused earlier today trying to get <https://github.com/logseq/logseq> up locally so you helped me simplify it and hopefully i can get it going toniight

Lukas 2021-02-04T21:29:26.179800Z

Glad I could also help I guess

1