This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-09
Channels
- # announcements (4)
- # babashka (16)
- # beginners (4)
- # calva (19)
- # cider (61)
- # clj-commons (3)
- # clj-kondo (8)
- # clojure (68)
- # clojure-boston (1)
- # clojure-brasil (1)
- # clojure-europe (16)
- # clojure-hungary (2)
- # clojure-nl (1)
- # clojure-norway (39)
- # clojure-spec (2)
- # clojure-uk (4)
- # clojuredesign-podcast (16)
- # clojurescript (17)
- # core-typed (7)
- # cursive (17)
- # data-science (7)
- # datalevin (19)
- # datomic (1)
- # events (6)
- # hyperfiddle (6)
- # kaocha (9)
- # london-clojurians (2)
- # malli (10)
- # off-topic (1)
- # other-languages (24)
- # portal (2)
- # practicalli (19)
- # rdf (1)
- # reitit (2)
- # releases (2)
- # shadow-cljs (18)
- # testing (1)
- # xtdb (20)
- # yamlscript (4)
What would be a way to test a function "to point". I mean, I have a defn
and I would like to evaluate code up to point (`cider-eval-defun-up-to-point`) as if it was not inside a defn
so I can see what is going on. Basicaly, what cider-eval-sexp-up-to-point
when outside of defn
or def
. When I try to use this, I just get the defn
as a result of the evaluation.
?
Maybe related, when I do cider-eval-sexp-up-to-point
inside a let, I get errors of unresolved symbols (the ones defined in the lets), as if the let was not evaluated?
Not sure if it helps, but there is also cider-eval-sexp-at-point-in-context
where you can specify missing let-bindings interactively
So, it looks like by not having bb.edn
it will not detect a project, which will not have a project-type
, hence the problems. (cider-jack-in-clj '(:project-type babashka))
works.
But then, babashka scripts can be just that: scripts. Shouldn't CIDER detect that a .bb
file is a Babashka "project-type" and go with it?
What if there's already a deps.edn/etc file? Given those possible ramifications, I'd suggest creating a detailed github issue - it would be most welcome
So, it looks like by not having bb.edn
it will not detect a project, which will not have a project-type
, hence the problems. (cider-jack-in-clj '(:project-type babashka))
works.
But then, babashka scripts can be just that: scripts. Shouldn't CIDER detect that a .bb
file is a Babashka "project-type" and go with it?
Can someone who is CIDER savvy help me test a thing with the debugger? Itâs this reproduction project: https://github.com/javierrweiss/calva-debugger-issues. The function to debug is this:
#dbg
(defn counter
[top]
(let [cnt (atom 0)]
(dotimes [_ top]
(swap! cnt inc)
(println @cnt))))
In Calva it fails when stepping past swap! cnt
. When I try it with CIDER it also fails, with
java.lang.RuntimeException: Invalid token: :
at clojure.lang.Util.runtimeException (Util.java:221)
clojure.lang.LispReader.interpretToken (LispReader.java:412)
but I may be holding things wrong. I want to figure out where this issue is best addressed. If itâs in Calva I am ready to take it on. đThis is fine to escalate to a GH issue - the debugger is occasionally but steadily maintained
Iâm just so bad with Emacs, I donât know if I am doing my test wrong. Where should the issue be raised if we deem there should be one raised?
Upon further investigation using Calva, I think I now have reason to suspect the bug is in cider-nrepl. I reported it here: https://github.com/clojure-emacs/cider-nrepl/issues/865
Let me know if I can improve the issue. And let me know if you want me to have a look at how to fix it. Canât promise success, but I would find it fun to give it a go.
Issue looks great, thank you :) Probably a repro in form of a deftest would be a good start if you'd want to give it a shot - IIRC there are misc tests for the debugger. WIth a bit of luck that failing test would make things easy enough for you to also come up with a fix
Be my guest, @U0739PUFQ. Something that would help me tons is if you record yourself taking a look. It was a long time ago I tried to hack on anything nrepl, and I remember having troubles finding a good setup and workflow.
so both examples (the one on the issue and the one here) works for me
fwiw, cider-nrepl has a decent readme and makefile, if you find it's not the case we'd be happy to keep a hackable env
the debugger is stopping first on (3 1) for !a
and then on (3) for (deref !a)
@U0739PUFQ, ah, so we have some cases like that in Calva for syntax quotes and such. I should add one for deref too?
this is how it shows
this is the message that starts the thing (when we evaluate (boom)) it will stop first on (3 1)
and then, when we ask for :next
it will return the value for (3) for the deref
Then we should close the issue. And possibly raise a new one about documentation for the coor thing and what to expect as an implementor.
I can explain how that works
so, when you eval instrumented, the debugger is first walking down the expression (before macroexpansion) and tagging all symbols and expressions with a coord meta. So here it will be tagging (deref ...)
with (3) and !a
with (3 1). Then it macroexpands and then it walks down the macroexpanded form, and when it sees a coor tag it will wrap it with the breaking/reporting
> Does the CIDER debugger show the value #atom[0 âŠ]
for the [3]
path?
the #atom[..] is for [3 1], that is the first screenshot I pasted
[3] will be reported for the deref, so, the integer
which is the second screenshot
true haha
yeah XD, was referring to the nrepl messages screenshots
My question is if thereâs a corresponding screenshot for the first screenshot (the really first one) where it shows the atom value. Or if it skips that and shows only the value inside.
oh yeah, let me run it again
if you want to try it yourself, what I'm doing here is after jack-in, runing M-x cider-selector
then m
, this will show you the *nrepl-messages ...*
buffer where you can see all the messaging exchanges.
On a Clojure buffer you define the function and evaluate it with C-u C-M-x
, that will evaluate it wrapped in a #dbg
, so no need to write that tag. It will highlight the function when it is instrumented.
Then when you run (boom) you should find yourself inside the debugger. Hitting the n
key should move you step by step until the end
I had a completely other UI when I tried this. It was some big buttons in the title bar of the window, and when I pressed the one I think corresponds to step over, it crashed with the Java exception in TS.
I get suicidal trying to use Emacs, actually. I wish I had more patience. But if I can figure out how to get the UI you get there, then the nrepl message log would be helpful for me to try to figure out how Calva should deal with this.
sure, let me know if you need help with that, I can jump into a meeting
I guess we should go with zoom or google meetup
I have normal zoom, I don't pay anything XD
I think this is it https://us04web.zoom.us/j/73216880960?pwd=AkRGpyhOu2WNktE43FqF16RsFKZ07D.1 Zoom is about as easy to use as Emacs is for me. đ
yeah haha
looks like I'm waiting for you to accept me
I was holding CIDER wrong, and have closed the issue. Will release a fixed Calva in a jiffy. Thanks @U0739PUFQ! However, CIDER invited me to click the wrong button. I didnât even see the command bar that appeared in the buffer, and instead went for the rather huge green arrow with the tooltip next. Clicking that throws the java error from the thread start.