Fork me on GitHub
#cider
<
2018-06-14
>
theeternalpulse01:06:24

How do I force downloading the correct version of cider in emacs/spacemacs

theeternalpulse01:06:57

I'mgetting an issue with 0.18 and the nrepl

theeternalpulse01:06:14

I can connect but it pretty much stops after it starts, so I can't eval or use the repl

theeternalpulse01:06:44

should it be 0.17?

theeternalpulse01:06:15

of cider that is

dpsutton01:06:33

are you talking about cider or cider-nrepl? CIDER version is up to you: melpa stable is 0.17.0 and the melpa version is 0.18.0-SNAPSHOT

dpsutton01:06:53

do you get any feedback when it "pretty much stops"

theeternalpulse01:06:24

so I go to eval, and emacs highlights green, then red and says that I have to be connected to a clojurescript repl

theeternalpulse01:06:43

the odd thing is that the repl operates, but tells me that there is a mismatch

theeternalpulse01:06:04

WARNING: CIDER's version (0.18.0-snapshot) does not match cider-nrepl's version (0.17.0). Things will break!
         More information.
WARNING: No Clojure project was detected. The
refactor-nrepl middleware was not enabled. (You can mute this
warning by customizing `cljr-suppress-no-project-warning'.)

theeternalpulse01:06:31

the no project is an ongoing issue with trying to get it to connect with shadow-cljs

theeternalpulse01:06:36

not sure if that's related to why I can't eval

dpsutton01:06:48

are you using piggieback in your dependencies?

dpsutton01:06:27

or wait, you said shadow, so you aren't

theeternalpulse01:06:33

hmm, let me try something

dpsutton01:06:34

or does it? I don't remember

theeternalpulse01:06:44

reading through the nrepl docs, I think i'm missing SNAPSHOT

dpsutton01:06:57

yeah cider 0.18.0 does not exist

dpsutton01:06:05

only it's snapshot for development purposes

dpsutton01:06:27

yeah i see that from your output. do you explicitly say which cider-nrepl version to use?

theeternalpulse01:06:27

I changed it

WARNING: CIDER's version (0.18.0-snapshot) does not match cider-nrepl's version (0.17.0-snapshot). Things will break!

dpsutton01:06:41

changed what?

theeternalpulse01:06:51

the reference to cider-nrepl to use snapshot

dpsutton01:06:54

cider should inject its own nrepl dependency. if possible you should remove it

dpsutton01:06:17

that way you don't have to worry about them going in lockstep

dpsutton01:06:36

also, CIDER now injects cider/piggieback and i bet that might be mucking with some stuff as well

theeternalpulse01:06:54

now it's complaining about nil

theeternalpulse01:06:59

WARNING: CIDER's version (0.18.0-snapshot) does not match cider-nrepl's version (nil). Things will break!
         More information.

theeternalpulse01:06:13

I think I did something, I don't remember this happening when I first fiddled with shadow-cljs

dpsutton01:06:27

i don't know much about shadow unfortunately

theeternalpulse01:06:37

I think updating cider was the first thing I did before this started happening

dpsutton01:06:27

maybe downgrade to 0.16.0 and see what happens? then report a bug?

theeternalpulse01:06:19

from melpa or melpa-stable

dpsutton01:06:35

melpa-stable are the releases, melpa are the dev versions. although the non-snapshots might be on melpa as well. but melpa-stable are the intended releases

dpsutton01:06:01

it's kind of a pity that the base name "melpa" are the dev versions and you have to go out of your way to get the stable releases on "melpa-stable"

theeternalpulse01:06:08

let me try 0.17 stable

dpsutton01:06:18

i think it should be melpa and melpa-dev but that ship has sailed

theeternalpulse01:06:37

0.17 is seen by emacs as obsolete, it won't let me revert

dpsutton01:06:31

emacs or spacemacs?

theeternalpulse01:06:55

spacemacs, sorry

dpsutton01:06:06

0.17 is the current stable. that's a spacemacs problem then

theeternalpulse02:06:05

ahhh, so I just removed cider layer, restarted to have them cleared out, restarted and added cider layer, now it works perfectly

theeternalpulse02:06:15

finds the port by itself and project association

dpsutton02:06:53

and the repl is evaling just fine?

dpsutton02:06:59

the ole turn it off turn it on?

theeternalpulse02:06:12

That really needs to be at the top of my debugging

dpsutton02:06:40

elisp can be fickle. i named a variable comment-start in my own let binding and it would kill my emacs font locking and error out

theeternalpulse02:06:44

the obvious difference was that I'm using spacemacs, and it has it's own config I have no control of

dpsutton02:06:00

because that's a global var that's not supposed to be an integer apparently. go figure

dpsutton02:06:02

¯\(ツ)

theeternalpulse02:06:00

wild. I'm trying to tackle elisp myself and I hit walls very often

theeternalpulse02:06:34

the whole ecosystem is a massive state machine, have to know where the buttons and levers are buried under buttons and levers

bozhidar05:06:04

@jsa-aerial I think this was done in 0.17. It’s configurable.

vemv16:06:47

I am facing a single logical project, but divided into clj and cljs codebases, each with its own project.clj I'm more used to a single project.clj. Is the former scenario something CIDER can handle well? i.e. multiple connections, each with its own middleware running I presume Otherwise should I fire up two Emacs instances instead? Recommendations welcome

dpsutton16:06:16

so projectile uses the git root as the project so they will appear as one to that (which is probably good). but i believe in dispatching to repls CIDER looks for a base project.clj which means they will appropriately appear as two, wihch you probably want here

vemv16:06:40

and does CIDER work fine with two disparate projects? e.g. I don't want autocompletions from one project being offered for the other one

dpsutton16:06:52

yes just fine

dpsutton16:06:23

although if you are on 0.18.0-snapshot there's about to be a major overhaul of connections so you'll be kind of a canary on that front.

dpsutton16:06:35

if there are any problems 0.17.0 from melpa-stable should be just fine

vemv16:06:02

btw, how to install a fixed version? Last time I researched that didn't seem possible My code is like this

(dolist (package '(cider company queue fiplr clojure-mode clj-refactor
                         dash simpleclip helm-ag git-timemachine paren-face))
  (unless (package-installed-p package)
    (package-refresh-contents)
    (package-install package)))

dpsutton16:06:14

if you run into problems with things from one project being eval-ed in the other let me know. i've got a patch that makes that better that gets rid of the "last repl used" heuristic which i find is often not what i want

dpsutton16:06:55

getting on a flight i 'll let someone else answer

👍 4
richiardiandrea17:06:45

what can be the reason of a bunch of

[WARNING] No nREPL middleware descriptor in metadata of #'cider.piggieback/wrap-cljs-repl, see clojure.tools.middleware/set-descriptor!
...
?

richiardiandrea17:06:39

oh it seems the namespaces for nrepl have not been changed in https://github.com/nrepl/piggieback

richiardiandrea17:06:14

is there a reason why not or just folks did not get to it yet? should I do it?

bozhidar17:06:53

@richiardiandrea I haven’t had time to add a lein task to spin nREPL for CIDER. Without this there’s no way to start a new nREPL server, as lein doesn’t support it yet. Same issue with boot.

bozhidar17:06:22

When this is done I’ll update all the middleware to target the new nREPL.

richiardiandrea17:06:43

@bozhidar I was wondering because I changed the namespaces in shadow but I started to have all the warnings, it seems the until cider/piggieback changes this https://github.com/nrepl/piggieback/blob/master/src/cider/piggieback.clj#L5

richiardiandrea17:06:57

it cannot work with nrepl 0.4.1

richiardiandrea17:06:25

sorry I re-read your message

bozhidar17:06:23

Yeah, once the boot and lein tasks are added to cider-nrepl we’ll just update our defcustoms and all the middlewares.

👍 4
bozhidar17:06:38

If you can just wrap your work on the boot task and do the very same task for lein that’d be appreciated!

👍 4
richiardiandrea17:06:33

about the boot task, do you think that's all we need? I feel we would break a lot of stuff if we do not replicate the original boot task (the server one, which has a lot of options)

bozhidar17:06:28

Not sure how many people use those, I know I never did use any fancy options.

bozhidar17:06:07

If the tasks take more params that’d certainly be better, but I don’t view this is something that’s must have right now.

bozhidar17:06:45

If you decide to do something very flexible I won’t stop you, but right now I’ll just take anything that actually gets us to a running REPL. 🙂

richiardiandrea18:06:37

ok so if that's the case i will make sure it works than remove the WIP from that PR

cjsauer18:06:19

How would I go about adding an alias to the cider-jack-in command if using tools.deps? Does it happen to auto-add :dev or :repl or anything I can hook into?

richiardiandrea18:06:30

@cjsauer this is what I have in my dir-locals.el

richiardiandrea18:06:42

...
      (cider-preferred-build-tool . "clojure-cli")
      (cider-clojure-cli-global-options . "-A:cljs-jvm:dev:unit-test")

cjsauer18:06:52

@richiardiandrea hm...can't seem to get that working. Is the file .dir-locals.el, with the leading dot? I admittedly haven't used local variables in emacs before 😅

richiardiandrea19:06:30

yeah it is with a dot and you need revert-buffer to load them

cjsauer19:06:04

@richiardiandrea with this as .dir-locals.el I keep getting Wrong type argument: listp...

(cider-preferred-build-tool . "clojure-cli")
(cider-clojure-cli-global-options . "-A:dev")
:thinking_face:

cjsauer19:06:11

Do I need to wrap these forms in a list?

cjsauer19:06:28

I found I can just write a shell script with this in it:

clj -A:dev:test -Sdeps '{:deps {cider/cider-nrepl {:mvn/version "0.17.0-SNAPSHOT"} refactor-nrepl {:mvn/version "2.4.0-SNAPSHOT"}}}' -e '(require (quote cider-nrepl.main)) (cider-nrepl.main/init ["cider.nrepl/cider-middleware"])'

cjsauer19:06:41

Almost does the right thing, but refactor-nrepl isn't getting loaded...

cjsauer19:06:57

Guessing I need to add it to the middleware stack...

cjsauer19:06:15

Aha:

clj -A:dev:test -Sdeps '{:deps {cider/cider-nrepl {:mvn/version "0.17.0-SNAPSHOT"} refactor-nrepl {:mvn/version "2.4.0-SNAPSHOT"}}}' -e '(require (quote cider-nrepl.main)) (cider-nrepl.main/init ["cider.nrepl/cider-middleware" "refactor-nrepl.middleware/wrap-refactor"])'

cjsauer19:06:23

This works, now I can just cider-connect to that

richiardiandrea19:06:47

@cjsauer sorry yeah you can do that but also use .dir-locals.el, the format is not exactly the one I sent you because I have extracted only the salient parts 😉

richiardiandrea19:06:24

but cider inject its own deps so you can avoid lauching terminal scripts by using the above defcustoms

cjsauer19:06:57

@richiardiandrea ah ok. I'm not familiar at all with .el files, I come from the land of Vim haha

cjsauer19:06:18

Would the syntax be:

(defcustom
  (cider-preferred-build-tool . "clojure-cli"))
Something like this?

richiardiandrea19:06:58

@cjsauer sorry a bit busy now but you can google emacs .dir-locals.el or if you use projectile you can delete the file and use C-c p E

cjsauer19:06:35

Thanks for the help @richiardiandrea, appreciate it 🍻

Garrett Hopper20:06:08

Is there a way to use the cljs browser repl via cljs.main?

Garrett Hopper20:06:45

Do I need to manually setup a cider-nrepl repl then start the browser cljs repl?

richiardiandrea21:06:59

@ghopper my PR should be in. figwheel-main is the type