Fork me on GitHub
#cider
<
2018-08-15
>
triss11:08:31

hey all. I’m using spacemacs and my refactoring doesn’t appear to work. I can’t rename symbols. It tries to analyze the project and then comes back with an error in the minibuffer I don’t manage to read.

triss11:08:42

I’m on OS X… does anyone know whats up?

bozhidar12:08:59

@triss some version information will be useful. What’s your CIDER, cider-nrepl and refactor-nrepl.

triss12:08:56

;; CIDER 0.17.0snapshot (package: 20180207.2103), nREPL 0.2.13…

triss12:08:10

just double checking I have refactor-nrepl maybe thats the missing piece!

triss12:08:24

maybe my refactor nrepl is a bit old

triss12:08:18

Ok I just updated to refactor-nrepl latest version

triss12:08:56

still the same issue.

bozhidar12:08:52

What’s the error you’re getting?

triss12:08:15

I can’t see - just abig stack trace that flashes by in the mini-buffer

triss12:08:30

It asks me if I want to analyze the project

triss12:08:39

It sasy Fetching symbol occurences just before bombing out

triss12:08:16

oh sorry I jut found it in Messages

triss12:08:01

I think it’s an issue with some of my namespaces… sorry for all the noise. just finding my way in to CIDER properly…

vinai12:08:47

I've trying to get CIDER running in a lein based project after upgrading emacs and CIDER. The currently installed CIDER package version is 20180813.1518. In the project.clj I removed all references to org.clojure/tools.nrepl (and com.cemerick/piggieback) because my understanding based on http://docs.cider.mx/en/latest/installation/ is CIDER will inject the new moved versions automatically. Please note that nrepl/drawbridge "0.1.3" also is a project dependency. As a first step, I would like to get the JVM Clojure repl running again. Once that works I'll tackle the (figwheel) cljs repl. When I run cider-jack-in-clj, Clojure fails to start and in *Messages* I find

Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.dataformat.smile.SmileFactory
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:374)
	at clojure.lang.RT.classForName(RT.java:2204)
	at clojure.lang.RT.classForName(RT.java:2213)
	at cheshire.factory__init.__init0(Unknown Source)
	at cheshire.factory__init.<clinit>(Unknown Source)
	... 233 more
Note: com.fasterxml.jackson.core/jackson-core is not explicitly referenced or excluded in the project.clj). This project was up and running 2 weeks ago the last time with the old version of emacs and CIDER. Can someone hold my hand and help me get up and running again? Is more of the stacktrace useful?

bozhidar12:08:34

@vinai Is this from drawbridge?

bozhidar12:08:48

I’ve never even heard of this XML library.

vinai12:08:02

I think auth.buddy uses it

vinai12:08:47

Maybe it's easier to start from the unmodified project.clj.

vinai12:08:47

Okay, I reset the project so it contains the old drawbridge and nrepl dependencies and run cider-jack-in-clj and it comes up!

vinai12:08:17

Now, I'll try replacing nrepl and drawbridge with the new versions again.

mgrbyte12:08:38

wondering if anyone can help with me fix this error. I'm using emacs 26.1, and cider from MELPA (`0.18snapshot`). I like to use a stand-alone repl, and have followed the cider manual's troubleshooting section , but not having any luck. I have the same version specified in the :repl the lein profiles.clj (`0.18.0-SNAPSHOT`) as I'm using in emacs. I'm using Leiningen 2.8.1 on Java 1.8.0_171 OpenJDK 64-Bit Server VM. The error I'm getting when running cider-connect is:

Debugger entered--Lisp error: (error "Version must be a string")
  signal(error ("Version must be a string"))
  error("Version must be a string")
  version-to-list(nil)
  version<=("0.18.0" nil)
  cider--check-middleware-compatibility()
  cider--connected-handler()
  run-hooks(nrepl-connected-hook)
  nrepl-start-client-process("localhost" 36225 nil #f(compiled-function (_) #<bytecode 0x29233bd>))
  cider-nrepl-connect((:project-dir "~/git/wormbase-names/" :host "localhost" :port 36225 :repl-init-function nil :session-name nil :repl-type "clj"))
  cider-connect-clj(nil)
  funcall-interactively(cider-connect-clj nil)
  call-interactively(cider-connect-clj nil nil)
  command-execute(cider-connect-clj)
I'm using lein, here the profiles.clj I'm using: https://github.com/mgrbyte/dot-files/blob/master/lein/.lein/profiles.clj My emacs cider setup: https://github.com/mgrbyte/emacs.d/blob/master/init.el#L333-L340 cider-jack-in works for me, so I assume I've missed something simple, but can't see what after a couple of hours staring at this.

vinai12:08:01

Should I remove the explicit dependency on [org.clojure/tools.nrepl "0.2.13"] or should I replace it with nrepl "0.4.4"?

vinai12:08:26

Just removing the references to the old tools.nrepl seems to work. Next, I'll try to replace drawbridge. 1. Dependency changed [com.cemerick/drawbridge "0.0.7"] to [nrepl/drawbridge "0.1.3"] 2. Require changed [cemerick.drawbridge :as drawbridge] to [drawbridge.core :as drawbridge] Aaand it seems like that worked, too. So it looks like before I was taking a too large step at once. Sorry for wasting your time.

vinai13:08:24

Now I'll try cider-jack-in-cljs with ClojureScript REPL type figwheel with the old piggieback in the project.clj. That works. I'll try to move piggieback now: In the :dev profile I replace [com.cemerick/piggieback "0.2.2"] with [cider/piggieback "0.3.8"] And in :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]} I replace it with cider.piggieback/wrap-cljs-repl. Now when running cider-jack-in-cljs with REPL type figwheel I get the error

!!! Unable to load a ClojureScript nREPL middleware library
Exception Failed to launch Figwheel CLJS REPL: nREPL connection found but unable to load piggieback.
This is commonly caused by
 A) not providing piggieback as a dependency and/or
 B) not adding piggieback middleware into your nrepl middleware chain.

example profile.clj code:
-----
:profiles {:dev {:dependencies [[com.cemerick/piggieback <current-version>]
                                [org.clojure/tools.nrepl  <current-version>]]
                 :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}}
-----
Please see the documentation for piggieback here 
I'm confused that the error is still referencing the old piggieback and nrepl locations.

vinai13:08:01

It seems I'm running CIDER 0.18.0snapshot (package: 20180813.1518) with the old nREPL 0.2.13. I thought they where incompatible?

bhauman13:08:15

@vinai you probably need a newer version of figwheel-sidecar

vinai13:08:37

Currently using 0.5.15, will check

bhauman13:08:47

0.5.16 is what you need

bhauman13:08:12

that's when I changed it so that it could work with cider/piggieback

vinai13:08:03

I guess I should use figwheel 0.5.16, too?

vinai13:08:39

And yes, that worked! Thank you!!

mario.cordova.86215:08:08

I keep getting could not locate ring/server/standalone__init.class on classpath. I have no idea how to fix this issue.

mario.cordova.86215:08:39

Would running Cider with with-profiles fix this issue?

mgrbyte15:08:58

sounds like it. You can set cider-lein-parameters to "with-profile +profile1 +profile2 repl :headless via customize-variable, in your .emacs/init.el or .dir-locals

mgrbyte15:08:11

for example.

mario.cordova.86216:08:04

Is that all in double quotes when I prompted with Set cider-lein-parameters globally to value:

mgrbyte16:08:32

if you're setting it via customize-variable, then no quotes required around it I don't think.

mario.cordova.86216:08:46

I am running the commands. 1. SPC SPC 2. set-variable 3. cider-lein-parameters

mario.cordova.86216:08:57

The I get that prompt from above

mario.cordova.86216:08:03

It seems like I do need the quotes

mario.cordova.86216:08:56

@mgrbyte Thanks! So basically it was with-profile profile1, profile2 repl :headless

mario.cordova.86216:08:06

The comma was needed

mgrbyte09:08:30

doh, of course, sorry

mario.cordova.86215:08:59

I have two profiles I normally use to run the project.

mario.cordova.86216:08:04

Feels so good having a REPL now 😅

mario.cordova.86216:08:26

Not having it was the bane of my spacemacs experience

bozhidar16:08:45

@mgrbyte Your profiles setup seems correct, but the error you got indicates that cider-nrepl is not loaded at all.

bozhidar16:08:55

Therefore the nil version.

mgrbyte12:08:26

You were right! 🙂

mgrbyte12:08:59

I'm using deps.edn (via lein-tools-deps), and it seems it's not merging the lein profile

mgrbyte12:08:32

I added cider-nrepl to the :extra-deps of my :dev alias, and now it connects

mgrbyte12:08:59

Although now I get:

WARNING: CIDER 0.18.0-snapshot requires cider-nrepl to work normally. Please, install it!
         More information.
WARNING: clj-refactor and refactor-nrepl are out of sync.
Their versions are 2.4.0-SNAPSHOT (package: 20180808.606) and n/a, respectively.
You can mute this warning by changing cljr-suppress-middleware-warnings.

mgrbyte12:08:17

So am guessing a similar issue 🤔

mgrbyte12:08:32

Noticed that in the cider manual it mentions that it's a common mistake to put cider-nrepl in :plugins instead of :dependencies in the :repl profile - think a reason for this might be that refactor-nrepl has that on it's github README.

mgrbyte12:08:51

I misread.

mgrbyte13:08:09

FWIW, I have successfully resolved my issue (using 0.18.0-SNAPSHOT) - working from both cider-connect and cider-jack-in-clj. The trick was to remove the configuration in ~/.lein/profiles.clj and move it to my :dev profile in project.clj. Something not quite right, but probably because I'm using tools-deps and lein and latest snapshot. Something not quite right with profile merging when tools-deps in place. TBH I've always experienced issues with lein profile merging, something I hope goes away! 😆

richiardiandrea16:08:16

where can I find how to add metadata to Clojure for formatting?

richiardiandrea17:08:12

ok found, but I have a problem, I have a macro like let and I am using {:style/indent 1} like clojure-mode...but I do not get the body forms aligned right

fenton19:08:30

@vinai could you post your project.clj that has a final working version of all the new cider settings. would be very useful to see it all in one place 🙂

vinai19:08:11

@fenton sure, it's rather big, but if it helps...

fenton19:08:48

cider-jack-in-cljs seems to create a clojure not clojurescript repl...

fenton20:08:17

@vinai i think i gleaned what was required... , but not sure i've got a cljs repl in the end....

vinai20:08:08

This works now with clj + cljs figwheel repl

fenton20:08:11

@vinai what function are you running to get a cljs repl?

vinai20:08:30

cider-jack-in-cljs or cider-jack-in-clj&cljs

bhauman20:08:58

oh darn I'm getting the slow down in cljc files again

fenton20:08:20

@vinai thx I'll try to compare with what I've got as ...&cljs isn't bringing up a cljs repl 🙂