-
-
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
Indented code cannot be debugged in-source #2852
Comments
if the above solution looks alright I can open PRs in both repos to fix it. |
Yeah, I think the proposed solution is reasonable. |
//cc @PEZ |
Thanks for the heads-up! I'll consult with @bpringe about wether Calva is vulnerable, and how we can mitigate. When will the change in cider-nrepl be released? |
I did it already - 0.25.2. |
I believe I accounted for this in Calva already, maybe even accidentally 😄. I tested Calva with this scenario with cider-nrepl before 0.25.2 and with it and it works as expected. 🎉 |
Great! |
Expected behavior
Executing cider-debug-defun-at-point (C-u C-M-x) should work in source for forms in an indented comment block when
clojure-toplevel-inside-comment-form
is true.More generally, this occurs when evaluating any indented form tagged with #dbg
Actual behavior
The source "cannot be found" and a temporary debug buffer is created.
Steps to reproduce the problem
place cursor at | and eval last sexp
Solution
After some detective work I found the underlying issue to be the difference in column indexing between Emacs (0-indexed) and Clojure (1-indexed).
The outgoing conversion to 1-indexing happens in
cider-interactive-eval
, using the functioncider-column-number-at-pos
, so nrepl messages are sent as 1-indexed columns.cider/cider-util.el
Line 757 in 1911c47
However for incoming responses, this line in cider-nrepl causes only toplevel forms (column = 1) to be converted to 0-indexing , and no further processing is done client-side.
clojure-emacs/cider-nrepl@7660eb7#diff-0d65c570bef3dbf4640690a252e06f28R340
When column != 1 this causes an off-by-one error and the cider-debug code thinks the source has been edited.
I think the proper solution to this would be to remove the above line in cider-nrepl and offset the 1-indexed response in Emacs. This may break other clients, in particular Calva.
Environment & Version information
CIDER version information
Emacs version
26.3
Operating system
macOS 10.14
The text was updated successfully, but these errors were encountered: