New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugging in Cider #170
Debugging in Cider #170
Conversation
The tests are failing with |
This is because of |
Yes, I'll try to ping the developer now. |
It's very good |
@Bruce-Connor To answer your question: "I'd like to know if the implementation is welcome before delving more into it", I think this is more than welcome :) |
Ok. I just pushed an update to both repos which:
I'm going to play around with this for a few hours to see if I spot any problems. But if it all works as I expect I think this is pretty close to complete. There are many additional features that could be implemented (some of which are listed on first comment above), but what we have now is enough to stand on its own. |
forms)))) | ||
|
||
(def specifier-map | ||
"Map between specifiers and [matcher handler] functions." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason this isn't a multimethod dispatching on the keys in this map?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason in particular. I'll look into that now, thanks.
I'm fine with releasing this with it's current features set, but have to take care of the outstanding debugger issues first:
Both changes, should be fairly easy. |
Btw, you should mention the new middleware in the README and we should figure out what's wrong with the travis build. |
I had a brief look through debugger's source yesterday, and clj-time is used only 2 or 3 times. So it shouldn't be hard for someone to send a pull request.
👍
👍 :-( |
Added a menu-bar item and a snippet to the readme. |
I cannot try this one. On jack-in I am getting:
|
|
||
(defn wrap-debug [h] | ||
(fn [{:keys [op force] :as msg}] | ||
(if (= "init-debugger" (:op msg)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is op local already :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops :)
@vspinu Did you do the |
(if (and debugger-message (not force)) | ||
(transport/send (:transport msg) | ||
(response-for msg :status :done)) | ||
(do (when debugger-message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I think I understand now. You are using debugger-message
simply as a storage for the most recent debug-init
request (given that cider-debug-defun-at-point
is calling cider--debug-init-connection
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it stores the first request it receives, and immediately closes all subsequent ones. But it makes no difference in the end. We could store the most recent instead, and close the older one, and the final effect would be the same.
Regardless. I think I'll rewrite cider-debug-defun-at-point
the way we discussed above, so that this whole thing will no longer be necessary.
I missed that part. thanks. |
@Bruce-Connor So, we now need a new release of |
@bbatsov Yes. I'm not familiar with how releasing works in the clojure/lein world (though, I noticed cider-nrepl snapshots builds seem to follow the repo) |
They follow it, because I constantly update clojars. :-) It's not an automated process. At any rate - 0.1.5 is out. You can use it to wrap this. |
I've bumped the dependency, but I'm at work so I haven't tried building the jar yet. |
If linting is the only hold up here, let's just disable it and squash and merge the PR. It'd be nice to start collecting feedback from CIDER's users. |
I get the same error when linting |
Linting is the only issue, I think. |
I'm playing around with it here, and it seems we can't merge just quite yet. There are two problems:
That assertion is indeed one of the things I changed to drop the |
Actually, now that I'm looking into clojure assertions, I think that assertion is ill-defined, there should be square brackets around it. The reason why reevaluating one of our function suddenly got rid of that is completely beyond me... |
Ok. Now you have my 👍 to merge. |
New version of clj-debugger is out. Fingers crossed. :-) |
🎉 |
Squash the commits in both PRs. On Saturday, March 28, 2015, Artur Malabarba notifications@github.com
Best Regards, |
Doing that now. And by the way, can I bind |
(Despite the lack of question marks, that was a question :-) |
Squashed |
And apparently I broke the tests... Looking into it... |
:-) |
Ops, didn't see this - yeah, let's make it consistent with edebug. |
The instrumenter will walk through the code and wrap in breakpoints anything that looks non-trivial. Entry-point is the `instrument` function. See doc and code comments on how to use it.
Ok. The eastwook test will still fail because of that |
Won't using |
👍 Now using an atom. |
(transport/send (:transport stored-message) | ||
(response-for stored-message :status :done))) | ||
;; TODO: Redefine this in the session binding map, see inspect.clj. | ||
(swap! debugger-message (constantly msg))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In such cases you should use reset!
.
And the linting failed again... Merging this PR has become an epic undertaking! :-) |
This only works in combination with cider-debug.el. To use it, invoke M-x cider-debug-defun-at-point
Done
Yeah. That's the failure we already had and couldn't figure out the reason. @cichli mentioned it might be from debugger or from a bug in eastwood. |
OK, I'll just disable the linting for the time being. |
I've opened razum2um/clj-debugger/pull/10 for the lint issue. |
This goes with clojure-emacs/cider#1019.
What is this?
An edebug-like debugger for cider. You can:
How to use it
Do the usual
M-x cider-jackin
, but make sure you're using clojure >= 1.6. For instance,Call
M-x cider-debug-defun-at-point
with point inside a top-level sexp.For a regular sexp this will immediately start debugging. If the top-level sexp was a
defn
, it will start debugging when you run the function.Once you're in the debugger you can hit:
TODO
Possible Eventual Improvements
debugger-message
variable (see source comments).