-
Notifications
You must be signed in to change notification settings - Fork 177
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
Fix broken instrumentation of forms with #? conditionals #435
Conversation
I guess this should also have some test and a changelog entry on CIDER's side ideally. |
Stepping through these forms probably won't work when they're slightly more complicated, but it's better than the current situation of not reading them at all. |
New lines in REPL throw "end of input" which makes it harder to debug that function.
src/cider/nrepl/middleware/debug.clj
Outdated
@@ -571,7 +571,9 @@ this map (identified by a key), and will `dissoc` it afterwards."} | |||
(interleave '[dbg break light]) | |||
(apply assoc *data-readers*))] | |||
(try | |||
(read-string {:read-cond :allow} code) | |||
;; new-line in REPL always throws; skip for debug convenience | |||
(when (> (count code) 3) |
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.
Shouldn't we check for them explicitly? Seems a bit arbitrary to check that something is 3+ characters.
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.
I am not completely sure what you mean but we do check for all of them explicitly with that fake reader above. All of them have >= 4 chars this is why 3 characters threshold. It's indeed arbitrary but avoids entering that code in simple cases when there is obviously no reader there. It could be 6 there just as fine :).
As mentioned in the comment, new line in REPL will throw and trigger that catch over there. When debugging I am placing a print there to see exactly what is going on, and those useless throws interfere with the experience. Does this clarify your question?
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.
Well, I guess you can just write more explanations here and that would be enough. I just assume that if some code is confusing to me it will probably be confusing to someone else as well.
Any forms that contain reader conditionals cannot be instrumented:
The reason is that conditionals are disabled by default in clojure's readers.