Fork me on GitHub
#cider
<
2016-07-12
>
malabarba04:07:03

@biscuitpants: there's no way to achieve that. The indent styles let you specify that a certain number of arguments are supposed to get a larger indentation. However, in your case the number of arguments you want isn't fixed, and the level of indentation you want isn't fixed either. :-/

chrisetheridge06:07:39

so the indentation only works for a set amount of args, i’m guessing?

jan.zy14:07:52

Hi, I am having a problem with refactoring code in cider. When I invoke M-x cljr-rename-symbol then emacs freezes for ca. 20 seconds and when it becomes responsive again I can see a following message in *Messages* buffer:

Fetching symbol occurrences...
nrepl-send-sync-request: Sync nREPL request timed out (op find-symbol prefix-rewriting true debug false ns abcd.service.transaction dir /Users/jan/Dev/evat/ file /Users/jan/Dev/evat/src/clj/abcd/service/transaction.clj line 204 column 19 name persist-transaction ignore-errors nil)

jan.zy14:07:07

this is happening only in one project

jan.zy14:07:25

$ find . -name '*.clj' | xargs wc -l
…
142912 total

jan.zy14:07:46

i guess that it happens because it has quite big codebase

jan.zy14:07:01

but i’d really appreciate any workaround for this issue

jan.zy14:07:52

the only relevant settings for cljr in my custom.el (I use Prelude):

(setq cljr-warn-on-eval nil)

benedek14:07:25

nice big project @jan.zy 😉

jan.zy14:07:27

heh true, not my creation though

jan.zy14:07:49

i am just a low-level peasant there

benedek14:07:22

so try to set cljr--debug-mode to t

benedek14:07:49

when you connect to cider your AST cache should be warmed

benedek14:07:00

debug mode would help in terms of telling you when warming is done

benedek14:07:08

could take longish on such a big project

benedek14:07:27

tbh if you keep on eye on cpu activity that would tell you the same too

benedek14:07:21

also in such a big project there could be some namespaces which we can’t build an AST for. so you can set cljr-ignore-analyzer-errors to t as well

jan.zy14:07:31

(setq cljr--debug-mode t) ?

benedek14:07:11

so it tells you when you have all the ASTs built. after that rename should be relatively snappy 😉

jan.zy14:07:43

hmm, it’s been ca. 30 minutes since I opened this project and started cider

jan.zy14:07:54

and i still see the same error

benedek14:07:15

do you still have a high cpu activity?

jan.zy14:07:39

and it looks that this is exactly this process

benedek14:07:54

hm.. try to set cljr-ignore-analyzer-errors too and restart

jan.zy14:07:32

ok, I can’t do that right now but I’ll come back to that soon

jan.zy14:07:40

thanks for help

benedek14:07:47

no worries. let me know how you get on

jan.zy14:07:56

i will, stay tuned

jan.zy19:07:11

@benedek: I retested refactoring. My config:

(setq cljr-warn-on-eval nil)
(setq cljr-ignore-analyzer-errors nil)
(setq cljr--debug-mode t)`
*Messages* Comments relate to logs below them:
;; T 0 min:
Connected.  Jan, this could be the start of a beautiful program.
;; CPU ~100% T 1 min:
Artifact cache updated
;; CPU stays at 100%...
;; T 5 min. CPU dropped to ca. 0%:
error in process filter: user-error: Some namespaces are in a bad state: error "nil" in taxamo.test.service.settlement-global-test; error "nil" in taxamo.test.service.tax-service-globalisation-test
error in process filter: Some namespaces are in a bad state: error "nil" in taxamo.test.service.settlement-global-test; error "nil" in taxamo.test.service.tax-service-globalisation-test

jan.zy19:07:41

Next, I tried to rename a symbol. 1. CPU grew up to 100% 2. In minibuffer I saw: Fetching symbol occurences…. 3. After ca. 20 seconds in *Messages* I noticed the same message as before:

Fetching symbol occurrences...
nrepl-send-sync-request: Sync nREPL request timed out (op find-symbol prefix-rewriting true debug true ns taxamo.service.transaction dir /Users/jan/Dev/evat/ file /Users/jan/Dev/evat/src/clj/taxamo/service/transaction.clj line 204 column 20 name persist-transaction ignore-errors nil)
4. CPU decreased to ca. 0%

jan.zy19:07:40

I can recreate it every time I restart REPL in this project

jan.zy19:07:09

I’ve seen error in process filter:… message in this project for a year now.

jan.zy19:07:56

and finally I’d like to solve debug and solve it.

benedek19:07:43

set ignore-AMALYZER-ERRORS to t

benedek19:07:03

Sorry for typos, uppercase. On my phone...

jan.zy19:07:46

I also found an exception in *nrepl-messages* ^^

jan.zy19:07:11

[baselayer is one of our home-made libraries]

jan.zy19:07:34

ok i’ll start again with (setq cljr-ignore-analyzer-errors t)

benedek19:07:12

Cool. That should help with those test nses which seem to be broken

jan.zy19:07:38

hmm, this time, there was no exception but the same error in *Messages*:

Fetching symbol occurrences...
nrepl-send-sync-request: Sync nREPL request timed out (op find-symbol prefix-rewriting true debug true ns taxamo.service.transaction dir /Users/jan/Dev/evat/ file /Users/jan/Dev/evat/src/clj/taxamo/service/transaction.clj line 160 column 9 name prepare-transaction-data ignore-errors true)

jan.zy19:07:05

in *nrepl-messages*:

(--> 
  op  "info"
  session  "de980247-4255-4072-8115-5c7955f3c0ad"
  ns  "taxamo.service.transaction"
  symbol  "prepare-transaction-data"
  id  "17"
)
(<-- 
  arglists-str  "([merchant transaction-data])"
  column  1
  file  "file:/Users/jan/Dev/evat/src/clj/taxamo/service/transaction.clj"
  id  "17"
  line  160
  name  "prepare-transaction-data"
  ns  "taxamo.service.transaction"
  session  "de980247-4255-4072-8115-5c7955f3c0ad"
  status  ("done")
)
(--> 
  op  "find-symbol"
  prefix-rewriting  "true"
  debug  "true"
  ns  "taxamo.service.transaction"
  dir  "/Users/jan/Dev/evat/"
  file  "/Users/jan/Dev/evat/src/clj/taxamo/service/transaction.clj"
  line  160
  column  9
  name  "prepare-transaction-data"
  ignore-errors  "true"
  session  "de980247-4255-4072-8115-5c7955f3c0ad"
  id  "18"
)
(<-- 
  id  "14"
  occurrence "REMOVED"
  session  "de980247-4255-4072-8115-5c7955f3c0ad"
)
(<-- 
  id  "14"
  occurrence  "REMOVED"
  session  "de980247-4255-4072-8115-5c7955f3c0ad"
)
(<-- 
  id  "14"
  occurrence  "{:line-beg 295, :line-end 295, :col-beg 33, :col-end 77, :file \"/Users/jan/Dev/evat/src/clj/taxamo/service/transaction_upload_service.clj\", :name \"taxamo.service.transaction/prepare-transaction-data\", :match \"transaction-data (transaction-service/prepare-transaction-data merchant transaction-data)\"}"
  session  "de980247-4255-4072-8115-5c7955f3c0ad"
)

jan.zy19:07:06

cider properly found occurences of the symbol (I removed that piece of log) and nothing else happened

jan.zy19:07:32

it looks like I’ll have to spend an evening debugging cider-nrepl unless you have some other ideas 🙂

benedek19:07:10

Have you seen a msg after jacking in like: "AST cache updated"?

benedek20:07:19

so I see two options here: - after jacking in you wait until you see "AST cache updated”, on a project this large this could take a long time. but after that rename-symbol should be snappy. (if it is not, that is deffo a bug, pls report it on github) other option needs a bit of explanation. rename symbol calls the middleware synchronously, reason being the project being in a broken state until the renaming is finished. so we want to block until all the renaming is finished. however if cljr-warn-on-eval is nil we define 25sec timeout, see line 2102 in clj-refactor.el: (let* ((nrepl-sync-request-timeout (if cljr-warn-on-eval nil 25)). I guess my reasoning here was that if warn-on-eval is nil we warm the ast cache so the whole thing should not take longer than 25sec. perhaps this is a wrong assumption. anyhow you can rewrite this line to be (nrepl-sync-request-timeout nil) re-evaluate the defun and see if that helps.