Fork me on GitHub
#cider
<
2017-07-23
>
kurt-o-sys04:07:34

@richiardiandrea It might be. I alread filed a question: https://github.com/boot-clj/boot/issues/632 - no answers yet. I'm starting to wonder if I'm the only one using boot and spacemacs who wants to rename symbols 🙂.

richiardiandrea04:07:52

@kurt-o-sys still good to solve that problem 😀

kurt-o-sys04:07:04

🙂 Not sure yet how exactly to make it work. I do get why it's not working, but that's not good enough 🙂

richiardiandrea04:07:25

Will try to look into it as well at some point 😀

kurt-o-sys04:07:53

thx. It'll be ok one day, I guess 😛

benedek06:07:36

so this is essentially the boot issue referenced here previously, right?

benedek07:07:47

specially and I guess @micha never created a boot issue for this or?

kurt-o-sys07:07:19

Well, not really - it is related, but not the same. The fix in https://github.com/clojure-emacs/refactor-nrepl/issues/97#issuecomment-121038439 don't solve the issue I have with renaming symbols (not the same as renaming files).

kurt-o-sys07:07:45

but it's true that the problem is that refactoring seems to use cache-files of boot.

benedek07:07:37

ok I can review your 10point reproduce description

kurt-o-sys07:07:09

@benedek the 10point review is actually another problem... There's a 7 point review to reproduce the replace symbol: 1. start a new boot project 2. position yourself on the println in core.clj 3. SPC m r e f (refactor - extract - function) and give it a name 4. see (println... extracted in a new function 5. position yourself on the new function 6. SPC m r r s (refactor - rename - symbol) and give it a name 7. see renaming performed on the cached file, not on the project file

benedek08:07:54

this sounds to me like the original problem i quoted. eg no way for boot to track back orig file location

kurt-o-sys08:07:37

right... so, you're saying it can't (or won't?) be solved?

kurt-o-sys08:07:26

I mean: renaming files/dirs does work. renaming symbols doesn't. The issue may be related, but is not the same. If it can't work, it's fine, but it'd be nice to know it can't work (so I can stop trying).

benedek08:07:52

sorry. I am just trying to make sense of it before having a proper look and perhaps do a PR for boot

benedek08:07:03

if the problem is really there

benedek08:07:31

if it is in cljr that is easier to fix ;)

kurt-o-sys08:07:35

right. That makes perfect sense... well, about the problem, I only know that it is because refactoring symbols seems to be working on boot cached files, probably because of these lines (although I'm not sure): https://github.com/clojure-emacs/refactor-nrepl/blob/992e9a25bdb411bc49c5c38a48ff0182d91631f2/src/refactor_nrepl/find/find_symbol.clj#L138 , having (core/dirs-on-classpath) this probably pointing to the cache-files, not the actual project files. It's a guess, but I'm not really sure about it.

benedek08:07:30

as far as I understand this is flagged to @micha in the github issue quoted

benedek08:07:08

and we kinda agree that we need at least an api in boot to properly handle this

benedek08:07:21

I will dblcheck this tho

benedek08:07:50

and if so will try to put together something for boot

kurt-o-sys08:07:26

ok... thx for the info. - it was a bit confusing, since renaming a file or dir seems to work, and the title doesn't seem to adddress renaming symbols (which doesn't work).

benedek08:07:18

nw will get back here after I see more clearly

dominicm09:07:29

@benedek this is the trick I came up with for cider-nrepl https://github.com/clojure-emacs/cider-nrepl/pull/422 If there's a better way to go from temp file → real file it would be useful to replace my code doing that.

benedek09:07:42

will have a look

benedek13:07:15

i was most likely wrong to drag @micha into this. sorry

dominicm14:07:45

I'm not certain, there might be something in the cache which allows us to figure out the origin

dominicm14:07:24

I mean, I suppose the proper thing to do would be to semantically strip the ~/.boot/cache/home/… relative to the cwd of the jvm or something like that

benedek14:07:27

based on the discussions around this i am not sure that is the case. acc to dearen one could use

boot.user=> (into (get-env :source-paths) (get-env :resource-paths))
#{"src" "resources"}

kurt-o-sys18:07:58

Not sure how this would help? I mean, :source-paths and resource-paths are set... Well, let me try first 🙂

benedek14:07:57

but i just went for the fake.class.path solution tbh

benedek14:07:34

new snapshot is on clojars, give it a spin @kurt-o-sys pls

dominicm15:07:38

That might have been more sensible for me to use :thinking_face:

benedek15:07:46

just lazyiness driven dev here

kurt-o-sys18:07:35

@benedek no errors, that's ok, but still saving to the boot cache files, not the project files.

kurt-o-sys18:07:33

oh wait... not sure if it's the right refactor-nrepl

benedek18:07:44

you are using latest snapshot, right?

kurt-o-sys18:07:44

well... I thought I was. This is my .boot/profile.boot:

(deftask cider "CIDER profile"
  []
  (require 'boot.repl)
  (swap! @(resolve 'boot.repl/*default-dependencies*)
         concat '[[org.clojure/tools.nrepl "0.2.12"]
                  [cider/cider-nrepl "0.15.0"]
                  [refactor-nrepl "2.4.0-SNAPSHOT"]])
  (swap! @(resolve 'boot.repl/*default-middleware*)
         concat '[cider.nrepl/cider-middleware
                  refactor-nrepl.middleware/wrap-refactor])
  identity)

benedek18:07:19

do you cider jack in or connect?

benedek18:07:57

should be latest tho. M-x cljr-versiontell you?

kurt-o-sys18:07:06

cider jack-in

benedek18:07:32

you don't need the above in your profile then

kurt-o-sys18:07:37

oh, wrong one...

kurt-o-sys18:07:48

I followed this https://github.com/boot-clj/boot/wiki/Cider-REPL#a-better-way - but apparently, I did something wrong 😛

dominicm18:07:05

@kurt-o-sys it's a bit confusing. cider-jack-in basically generates the cli by itself (and doesn't know about the cider task) the boot wiki is aimed at cli users really

kurt-o-sys18:07:38

ok... so, I can remove profile.boot and it should work?

radon18:07:09

Question: is require supposed to work in CIDER-CLJS?

radon18:07:37

Whenever I (require 'my-namespace) at the REPL, I get a spurious error message… even though I can perfectly well use my-namespace/functions-defined-there.

radon18:07:57

As suggested at https://groups.google.com/forum/#!topic/clojure/qSiGeQZzyT0, if I use cljs.core/require instead of require, it works.

radon18:07:22

But unfortunately that means I can’t evaluate a namespace declaration that depends on one of my other namespaces, because it gives me a big stack trace (since it uses regular require).

kurt-o-sys18:07:00

@dominicm Things seem to be more complicated. When I do SPC m s i (cider jack-in, apparently)

Starting nREPL server via /usr/local/bin/boot -i "(require 'cider.tasks)" -d org.clojure/tools.nrepl\:0.2.12 -d refactor-nrepl\:2.3.0-SNAPSHOT -d cider/cider-nrepl\:0.15.0-SNAPSHOT cider.tasks/add-middleware -m refactor-nrepl.middleware/wrap-refactor -m cider.nrepl/cider-middleware cider repl -s wait...
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: Classpath conflict: org.clojure/clojure version 1.9.0-alpha17 already loaded, NOT loading version 1.2.0
                              java.lang.Thread.run              Thread.java:  745
java.util.concurrent.ThreadPoolExecutor$Worker.run  ThreadPoolExecutor.java:  617
 java.util.concurrent.ThreadPoolExecutor.runWorker  ThreadPoolExecutor.java: 1142
               java.util.concurrent.FutureTask.run          FutureTask.java:  266
                                               ...                               
               clojure.core/binding-conveyor-fn/fn                 core.clj: 2027
                                 boot.core/boot/fn                 core.clj: 1030
                                               ...                               
                         boot.core/construct-tasks                 core.clj:  984
java.lang.IllegalArgumentException: No such task (cider)
        clojure.lang.ExceptionInfo: No such task (cider)
    file: "/tmp/boot.user8420735862008947390.clj"
    line: 31

error in process sentinel: Could not start nREPL server: Classpath conflict: org.clojure/clojure version 1.9.0-alpha17 already loaded, NOT loading version 1.2.0
                              java.lang.Thread.run              Thread.java:  745
java.util.concurrent.ThreadPoolExecutor$Worker.run  ThreadPoolExecutor.java:  617
 java.util.concurrent.ThreadPoolExecutor.runWorker  ThreadPoolExecutor.java: 1142
               java.util.concurrent.FutureTask.run          FutureTask.java:  266
                                               ...                               
               clojure.core/binding-conveyor-fn/fn                 core.clj: 2027
                                 boot.core/boot/fn                 core.clj: 1030
                                               ...                               
                         boot.core/construct-tasks                 core.clj:  984
java.lang.IllegalArgumentException: No such task (cider)
        clojure.lang.ExceptionInfo: No such task (cider)
    file: "/tmp/boot.user8420735862008947390.clj"
    line: 31

radon18:07:08

This issue has apparently been reported at https://dev.clojure.org/jira/browse/CLJS-1473, and probably has something to do with the namespace being created during my CIDER session, rather than coming purely from disk.

radon18:07:23

… but it seems like a pretty big usability problem. How do people manage it?

dominicm18:07:33

@kurt-o-sys you might need a boot.properties 🙂 boot -V > boot.properties and then update the clojure version to the one you want

kurt-o-sys18:07:13

inside my project folder:

$ cat boot.properties 
#
#Sun Jul 23 20:52:20 CEST 2017
BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_CLOJURE_VERSION=RELEASE
BOOT_VERSION=2.7.1

kurt-o-sys18:07:34

it seems boot is looking for a task cider (the one I deleted in profile.boot)

kurt-o-sys18:07:38

ok, got it: https://github.com/boot-clj/boot/wiki/Cider-REPL#a-better-way - step 2. This apparently changes some things...

kurt-o-sys19:07:09

so now... how to set the version of nrepl-refactor?

kurt-o-sys19:07:19

now I seem to be using 2.3.0-SNAPSHOT?

benedek19:07:31

it depends on the version of the emacs-lisp package

kurt-o-sys19:07:30

using the emacs-lisp layer in spacemacs...

kurt-o-sys19:07:57

ELISP> (emacs-version)
"GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)\n of 2016-04-17 on lgw01-04, modified by Debian"
this?

benedek19:07:32

nope. M-x cljr-version

benedek19:07:13

ah in repl just cljr-version

benedek19:07:17

I guess...

benedek19:07:53

this should tell you detailed version info

kurt-o-sys19:07:28

clj-refactor 2.3.0-SNAPSHOT (...) refactor-nrepl 2.3.0-SNAPSHOT - the wrong ones. How to make it us the right one? (The command above shows only the version)

benedek19:07:23

you use spacemacs I guess...

kurt-o-sys19:07:48

yeah, I do... I thought I mentioned that 😛. I may be wrong...

benedek19:07:28

tbh not sure about spacemacs specific way to upgrade but I would M-x package-install-package

benedek19:07:37

clj-refactor.el

kurt-o-sys19:07:47

right, well, the same way. That's how I did it.

kurt-o-sys19:07:54

oh, wait, sec.

kurt-o-sys19:07:12

damn'd. OK, let me look for that one

kurt-o-sys19:07:00

I think clj-refactor.el is installed... (repl works etc, but with the wrong version)

benedek19:07:06

you might want to upgrade cider too if you are at it ;)

benedek19:07:23

yup. you need to update it

kurt-o-sys19:07:01

ok, I guess I may be spamming the spacemacs channel in a few minutes 😛

benedek19:07:25

just run mx package-list-packages

benedek19:07:39

search for cider and clj-refactor

benedek19:07:06

press i on when you found each

benedek19:07:15

then x to run the upgrade

benedek19:07:21

then restart

benedek19:07:41

disclaimer: no idea about spacemacs specifics...

kurt-o-sys19:07:42

well, spacemacs is emacs with some standard config etc, as far as I understand... anyway, I'm updating a bunch of packages now. I'll be back in a few minutes 😛

benedek19:07:19

ah cool. GL

kurt-o-sys19:07:39

thx a lot. I suppose I'll get there today 🙂

kurt-o-sys19:07:35

Extracting clj-refactor-20170720.712/
Extracting clj-refactor-20170720.712/CHANGELOG.md
Wrote $HOME/.emacs.d/elpa/clj-refactor-20170720.712/CHANGELOG.md
Extracting clj-refactor-20170720.712/clj-refactor-pkg.el
Wrote $HOME/.emacs.d/elpa/clj-refactor-20170720.712/clj-refactor-pkg.el
Extracting clj-refactor-20170720.712/clj-refactor.el
Wrote $HOME/.emacs.d/elpa/clj-refactor-20170720.712/clj-refactor.el
doesn't look really bad, does it? (or should it be another version... well, let me try first)

benedek19:07:27

looks good

kurt-o-sys19:07:39

nice. Works, cool. Thanks a lot!

kurt-o-sys19:07:27

It's a bit confusing, the jack-in, connect, ... and boot repl, cider repl etc. But it works, thanks a lot!

dominicm19:07:18

@benedek the fix you came up with, was it already present, or did you add it? Struggling to follow along with what happened. Want to backport it into cider either way 🙂

dominicm19:07:29

Oh, I couldn't. I remember now. The problem was that I had a full path to a temp file, instead of a relative one.

benedek19:07:54

@kurt-o-sys cool. happy hacking!

benedek19:07:14

I've added it

benedek19:07:27

posted the commit sha here see above

benedek19:07:17

all I do is basically use fake.class.PATH for boot instead of regular java cp

benedek19:07:41

no idea if this makes any diff for cljs projects

dominicm19:07:46

@benedek cljs puts the :file metadata as /home/dominic/.boot/cache/tmp/home/dominic/src/github.com/juxt/bidi/680/jsfdkjk/edge/web_server.clj or something like that. I suppose I should try strip the real classpath prefixes from that or something. More accurate.

benedek19:07:42

ah so you don't need to strip the full path one level a time. yeah makes sense