This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-18
Channels
- # adventofcode (18)
- # announcements (1)
- # asami (99)
- # babashka (4)
- # beginners (45)
- # calva (20)
- # cider (44)
- # cljdoc (5)
- # clojure (66)
- # clojure-australia (2)
- # clojure-europe (36)
- # clojure-nl (11)
- # clojure-norway (4)
- # clojure-seattle (1)
- # clojure-uk (88)
- # clojurescript (37)
- # community-development (8)
- # conjure (8)
- # datascript (4)
- # datomic (29)
- # depstar (12)
- # emacs (7)
- # events (1)
- # fulcro (29)
- # graalvm (4)
- # graphql (2)
- # helix (2)
- # integrant (4)
- # jobs (7)
- # jobs-discuss (1)
- # lsp (3)
- # malli (6)
- # off-topic (61)
- # pathom (67)
- # pedestal (3)
- # re-frame (9)
- # reitit (4)
- # remote-jobs (13)
- # reveal (18)
- # shadow-cljs (59)
- # spacemacs (1)
- # sql (7)
- # startup-in-a-month (1)
- # tools-deps (29)
- # vim (12)
(defvar cider-repl-require-repl-utils-code
'((clj . "(clojure.core/apply clojure.core/require clojure.main/repl-requires)")
(cljs . "(require '[cljs.repl :refer [apropos dir doc find-doc print-doc pst source]])")))
(defcustom cider-repl-init-code (list (cdr (assoc 'clj cider-repl-require-repl-utils-code)))
"Clojure code to evaluate when starting a REPL.
Will be evaluated with bindings for set!-able vars in place."
:type '(list string)
:group 'cider-repl
:package-version '(cider . "0.21.0"))
Is there a way of adding a breakpoint that will be hit when e.g. an http request is made, i.e. when a function is called indirectly rather than directly
There should be no difference and your "breakpoint" should be triggered. That said, I often times get into a state where no breakpoints are activated for some reason - restarting the REPL typically helps.
hmm interesting. Is there more to it than doing cider-debug-defun-at-point
in the function you want to debug, and then exercising the endpoint that calls the function?
I think that's it: Of course you can also use #dbg
which can be convenient if you have a larger function or if you want to break only on a specific condition: https://docs.cider.mx/cider/debugging/debugger.html#conditional-breakpoints
Do I need extra middleware apart from cider.nrepl/cider-middleware?
thanks, I'll keep at it
oh, it's working
restarting the repl worked
Yeah, that's a PITA. I don't know why it sometimes happen but I hit this issue every now and then.
thanks for your help 🙂
Guess you found some weird bug - probably the state of the debugger gets corrupted by something, otherwise I can't imagine the need for a restart.
I stopped using the debugger years ago because the debugger was so temperamental debugging http requests.
I think the debugger stops working after I quit the debugger with q
after debugging an http request. I got this error: Execution error (NullPointerException) at cider.nrepl.middleware.debug/abort! (debug.clj:143)
, and then the debugger wouldn't start up again when debugging the same function and request.
Interesting observation - I didn't make a connection between these two things and I use q
every now and then.
I'll try to reproduce this in my project...
@U051H1KL1 you're right! It would be worth to report this - I'd love to see this fixed.
@U051H1KL1 IIRC now you mention it that sounds suspiciously similar to what I witnessed a few years back too — I thought I’d reported it, but it was maybe just on the slack channel and not in a ticket.
It calls Thread's .stop
method which is known to cause problems - maybe that't the issue? https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/debug.clj#L143
Maybe a workaround is to press C
to skip all the breakpoints? https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/debug.clj#L364
... Oh no, that doesn't work either - so just c
?
Yeah, c
works for me
Interestingly, when debugging a function that is called indirectly via http, q
doesn't appear on the list of options, and when pressed breaks the debugger going forward. When debugging a function called directly, q
does appear on the list of functions, and when pressed, does not break the debugger.
Same as with all other issues - monitoring the message exchange, instrumenting thing on the Elisp side and playing with the Clojure part of the debugger in the REPL.
If someone wants to see this fixed any time soon they'll have to look into the problem themselves. As I've mentioned a few times - effectively no one but me is working on all the CIDER/nREPL related stuff these days, which means progress is slow and painful (if any).
This is the most detailed overview of the internals of the debugger for those interested - https://drive.google.com/file/d/1YhnPBJOXbUzXfVOEojICFTwhCt_3u6Ss/view?usp=sharing
Am I doing something wrong here? I want to use an http mocking library in my tests, but I obviously don't need this in the production version of the library, so I added the dependency (clj-wiremock) like this:
{:paths ["src" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.10.2"}
clj-http/clj-http {:mvn/version "3.11.0"}
org.clojure/data.json {:mvn/version "1.0.0"}}
:aliases
{:test {:extra-paths ["test"]
:extra-deps {org.clojure/test.check {:mvn/version "1.1.0"}
kelveden/clj-wiremock {:mvn/version "1.5.7"}}}
but I can't eval the buffer on a test file in CIDER (C-c C-k). It does work if I move clj-wiremock
to the :deps
section. Is that right, or am I just missing something silly? I might be misunderstanding what the :test
alias is for...Ah, do I have to do that? How do I do that?
easiest way, hit C-u
before jacking in and add a -A:test
right after the bin/.../clojure
part
Right, thanks! I've gone this long without ever needing a test-only dependency...
no worries. if you update to the latest version of CIDER i can walk you through some dir-locals stuff to make sure you are always using the test alias so you never have to worry if you remembered to add it or not. it'll always be there when using CIDER
Anything one should look at beside (cider-clojure-cli-global-options . "-M:test")
?
i think that's correct. there was a little bit of flux and a clojure-cli-aliases
or something like that recently
still needs to be documented and its still missing a way to pass things at the end of the string to supply ports and such. ( i think)
ah, I see -- good to know!
Thanks. I probably am using the latest (I use straight.el), but other half is yelling at me to get off the computer. Will look this up... And that did work, btw. Thank you again!
I think the debugger stops working after I quit the debugger with q
after debugging an http request. I got this error: Execution error (NullPointerException) at cider.nrepl.middleware.debug/abort! (debug.clj:143)
, and then the debugger wouldn't start up again when debugging the same function and request.