-
-
Notifications
You must be signed in to change notification settings - Fork 645
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 #1019
Debugging in Cider #1019
Conversation
Adding a menu for this would be nice. You might also post an animated gif showcasing the prototype as some users might have a hard time updating the client and the middleware by themselves. |
Added gif on both posts. |
When you say menu, do you mean an item under the Cider menu-bar? |
Yes. And maybe a separate debug menu when the debugger is enabled (as in On 15 March 2015 at 18:16, Artur Malabarba notifications@github.com wrote:
Best Regards, |
@@ -786,6 +786,26 @@ for functionality like pretty-printing won't clobber the values of *1, *2, etc." | |||
(defvar nrepl-err-handler 'cider-default-err-handler | |||
"Evaluation error handler.") | |||
|
|||
(defvar-local nrepl--input-handler-queue nil |
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.
BTW, nrepl-client.el
already loads queue.el. You might consider using that data structure.
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.
Thanks for the pointer. Will do.
@Bruce-Connor thanks. Truly great job! Let's bind this to |
(nrepl-request:stdin | ||
;; For now we immediately try to read-char. Ideally, this will | ||
;; be done in a minor-mode (like edebug does) so that the user | ||
;; isn't blocked from doing anything else. |
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.
Yes, and also bound to some rarely used but easelly accessible combos (like C-Q
and C-C
) to avoidinterference with the editing. The only thing I dislike about edebug is the read-only lock.
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.
Making it read-only is a precaution we might need as well. The way it's currently designed, if the user edits the source file inside or before the instrumented sexp, then the debugger will start to misbehave. It will probably place point in the wrong places and might end up throwing an error while trying to navigate the code (due to calling forward-sexp in an invalid location).
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.
if the user edits the source file inside or before the instrumented sexp, then the debugger will start to misbehave.
The debugging can be aborted if that happens, similarly to what edebug does when the source has been modified.
Alternatively we can check the region for modifications, and if there have been such since the last instrumentation, re-instrument the definition in the background. Not sure if that's possible at debugger.core
level.
I agree. Printing can also always be done with |
@Malabarba Love the new handle. :-) |
Thanks. Just hoping I'll stop being called Bruce now. |
Well, to be honest I thought your name was Bruce Connor for a while myself. :-) |
Exactly. :-) It's my own fault, of course. |
Squashed. I can remove the keybind if it's not ok. |
Please, drop the |
Done |
Hmm, now the branch can't be merged. Guess it was not in sync with the current |
It allows cider modules to specify a function that will handle the next need-input event.
Add cider-debug-defun-at-point to the menu-bar. Bind cider-debug-defun-at-point to cider-eval-defun-at-point with a prefix. This needs debug.clj at cider-nrepl to work. Invoke M-x cider-debug-defun-at-point to see it in action.
Rebased |
🎉 |
🍺 |
Good job! |
🍻 |
Thanks for the great work. Happy to see debugging capabilities in Cider. (defn factorial
[n]
(loop [cnt n acc 1]
(if (zero? cnt)
acc
(recur (dec cnt) (* acc cnt))))) C-u C-c C-c to debug factorial gives an error in cider buffer:
(defn foo
[v]
(do v)) C-u C-c C-c to debug foo gives an error in cider buffer:
and also sometimes hangs cider repl so that only C-c C-c can stop it (at which point it gives a huge error with a stacktrace). |
Open a new issue. On Tuesday, March 31, 2015, Desmond Hayes notifications@github.com wrote:
Best Regards, |
@DesmondHayes thanks for catching these, could you open a new issue for them? Item 2 is probably an easy fix, we should be able to instrument that for sure. |
@DesmondHayes Nevermind. These should both be fixed on PR clojure-emacs/cider-nrepl#177 |
@Malabarba I've actually opened issue #1048. Also, have you seen #1049? |
Please how do I turn it off? |
@johnbendi What do you mean by that? The debugger is off until you activate it. |
—Reply to this email directly or view it on GitHub. |
|
This PR goes along with clojure-emacs/cider-nrepl#170, please see there for instructions.