Skip to content

Conversation

vspinu
Copy link
Contributor

@vspinu vspinu commented Oct 15, 2018

Two changes:

  • debugger forms are now localized in the sense that STATE__ is inserted where the reader form is located and not around the entire defun. Besides fixing non-closure situations as in Bugfix: Debugging deftype Forms #544 it is' likely to be useful in core-async contexts (macros with &env) for which there are a few issues open. Still have to check those.

  • implement a notion of a debugger session and build on top of it to fix a range of "continue" issues

There are now two continue commands, one local which stops on next #dbg or #break readers, and one global which behaves like the old continue. First one is now on c and the global on is on C.

I want to fix a few more debugger related issues but it seems wise to push these changes first so that people could start testing immediately.

@bbatsov
Copy link
Member

bbatsov commented Oct 15, 2018

@vspinu seems there's some real CI failure this time around:

src/cider/nrepl/middleware/debug.clj:367:24: wrong-arity: Function on var #'cider.nrepl.middleware.debug/skip-breaks! called with 1 args, but it is only known to take one of the following args: [atom mode] [atom mode coor code force?]

@vspinu
Copy link
Contributor Author

vspinu commented Oct 15, 2018

Yes. A lot of tests rely heavily on debugger internals. Will have a look tomorrow. I was deceived by ein with-profile +plugin.mranderson/config test which does close to nothing. The readme should be updated to describe the new ways of running tests.

Will label WIP for time being.

@vspinu vspinu added the wip label Oct 15, 2018
@bbatsov
Copy link
Member

bbatsov commented Oct 15, 2018

I never used this - only lein with-profile +1.9,+test-clj test (and friends). But yeah, we should improve the readme in this regard. It'd be nice if lein test ran something meaningful as well.

[orchard.meta :as m]
[clojure.java.io :as io])
[clojure.java.io :as io]
[cider.nrepl.middleware.util.nrepl :refer [notify-client]])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really need to sort the deps in this namespace. :-)

'[clojure.tools.nrepl.middleware.session :as session]
'[clojure.tools.nrepl.misc :refer [response-for]]
'[clojure.tools.nrepl.transport :as transport])
'[clojure.tools.nrepl.middleware.interruptible-eval :refer [*msg*]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original indentation seems correct to me. Do you have non-default settings for indentation in clojure-mode?

Copy link
Contributor Author

@vspinu vspinu Oct 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Standard settings. The new indentation seems correct to me (2 spaces).

But I do see problems indenting macros in cider-nrepl project. The {:style/indent 1} in try-if-let in debug.clj is not taking effect. Could you please confirm?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For ordinary lists the indentation is 1-space. I just check this.

try-if-let is broken for me as well. I also notice it's not font-locked as a macro, which is an indication of a deeper problem with dynamic font-locking/indentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually had clojure-indent-style set to non-default value and that was causing the indent. Shall we add this to .dir-locals?

{:status :eval-error
:causes [(let [causes# (stacktrace/analyze-causes e# (:pprint-fn *msg*))]
(when (coll? causes#) (last causes#)))]})))
{:status :eval-error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems like a another accidental change of indentation.

:stacktrace (-> (Exception. "Dummy")
(stacktrace/analyze-causes (:pprint-fn *msg*))
last :stacktrace)}]}))
{:status :stack
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.


(def debug-commands
{"c" :continue
"C" :Continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably give the keyword some different name. (more descriptive)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any concrete ideas? I thought of :Continue-all or :Continue-non-stop but both of them take valuable horizontal space during the debugger display.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably decouple this a bit from the UI (but that's an unrelated note), so we can provide a more compact view for people who actually know the commands.

I like :continue-non-stop, but I have to check with other debuggers. I'd also suggest using a lowercase letter as those are simpler to press.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am quite indifferent on this but I think C is not bad here. It should be rarely used and C is suggestive that it's a more complex version of c command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried :continue-non-stop and it's pretty ugly and hypens don't help with legibility.

clj_debug

So I am leaving Continue for now till we get better ideas on this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Debugger's menu says "Continue non stop", so I guess it should be fine as a first try.

(assoc dbg-state :inspect)
(recur value))
(recur value dbg-state))
(->> (debug-inspect page-size val)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your indentation is incorrect in all try-if-let forms.

@bbatsov
Copy link
Member

bbatsov commented Oct 16, 2018

Apart from the few accidental indentation changes and a couple of small remarks the changes look good to me. Might be nice to add a couple of tests for them.

And as usual - amazing work! The users are going to be super excited about those improvements!

@vspinu
Copy link
Contributor Author

vspinu commented Oct 16, 2018

I am no longer able to run cider tests interactively. With current master when run interactively tests in debug_integration_tests.clj fail but other tests which I have tried (appropos, format etc.) stall the nrepl.

Would you mind checking on your side if you could run any of the debug-interaction-tests by hand?

@bbatsov
Copy link
Member

bbatsov commented Oct 16, 2018

They freeze for me as well. No idea why, though. I can't think of any related changes.

@bbatsov
Copy link
Member

bbatsov commented Oct 16, 2018 via email

@bbatsov
Copy link
Member

bbatsov commented Oct 16, 2018 via email

@vspinu vspinu force-pushed the localized-debugger branch from eba4840 to 0780d91 Compare October 16, 2018 17:29
@vspinu vspinu force-pushed the localized-debugger branch from 0780d91 to efa335d Compare October 16, 2018 17:45
@vspinu vspinu force-pushed the localized-debugger branch from efa335d to 06d0cd6 Compare October 16, 2018 17:53
@vspinu
Copy link
Contributor Author

vspinu commented Oct 16, 2018

Should be good to go. There is an unrelated pprint failure in one job.

@bbatsov bbatsov merged commit c2ef541 into master Oct 16, 2018
@bbatsov bbatsov deleted the localized-debugger branch October 16, 2018 22:13
bbatsov pushed a commit to clojure-emacs/cider that referenced this pull request Oct 16, 2018
@vspinu vspinu removed the wip label Nov 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants