-
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
Stacktrace at point or in region #758
Conversation
Looks good, failing CI aside. |
src/cider/nrepl.clj
Outdated
:optional wrap-print-optional-arguments | ||
:optional (assoc wrap-print-optional-arguments "stacktrace" "The stacktrace to be parsed and analyzed as a string.") |
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 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 agree. Generally we've been using action-like names for most ops (e.g. eval
, clone
, etc), so the stacktrace op was named somewhat poorly in that regard anyways, as it was super clear what does it do by its name alone.
src/cider/nrepl.clj
Outdated
@@ -437,7 +437,11 @@ Depending on the type of the return value of the evaluation this middleware may | |||
:expects #{} | |||
:handles {"stacktrace" {:doc "Return messages describing each cause and stack frame of the most recent exception." | |||
:optional wrap-print-optional-arguments | |||
:returns {"status" "\"done\", or \"no-error\" if `*e` is nil"}}}})) | |||
:returns {"status" "\"done\", or \"no-error\" if `*e` is nil"}} | |||
"parse-stacktrace" {:doc "Parse the `stacktrace` and return messages describing each cause and stack frame." |
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.
@bbatsov I added a new op called parse-stacktrace
. Are you fine with this name?
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.
Hmm, I think I rename it to analyze-stacktrace
...
src/cider/nrepl.clj
Outdated
:requires {"stacktrace" "The stacktrace to be parsed and analyzed as a string."} | ||
:optional wrap-print-optional-arguments | ||
:returns {"status" "\"done\", or \"no-error\" if `stracktrace` is not recognized"}} | ||
"stacktrace" {:doc "Return messages describing each cause and stack frame of the most recent exception." |
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.
We can also add some alias for this op with a more descriptive name - e.g. analyze-last-stacktrace
or something like this. Or we can consider the new name an alias of the old one and make them behave the same way with/without an explicit stacktrace.
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 think I like analyze-last-stacktrace
but how would you do this alias? Just adding a new op and pointing to the same implementation? How do we deprecate the old one?
I think your second suggestion is what I had before (minus the rename). If the stacktrace parameter is present it would parse and analyze the value from the parameter, otherwise use the last exception when present. I think I would prefer separating those 2 ops, but up to you, I'm also fine with the optional parameter.
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 think I like analyze-last-stacktrace but how would you do this alias? Just adding a new op and pointing to the same implementation? How do we deprecate the old one?
Yeah, just a new pointing to the same implementation. At some point it might be nice to add better support for this to nREPL itself. As for the deprecation - some note in the docs will do. You can also use notify-client
to send them deprecation messages.
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.
@bbatsov I added the analyze-last-stacktrace
op and made the stacktrace
op deprecated. The deprecation is reflected in the docs and the stacktrace
op also does send a notification to the user. I am not sure if this is a good idea, because I had to make a change in Cider to handle this notification in the response. See here:
clojure-emacs/cider@0d0633a#diff-e5e7f12a3638dc838dbd4f61a5bd797efc0ac6120e58c80ec1a92970eea3a27cR479
I don't know which clients we have, but if they don't handle notification messages in a stacktrace response they might break. So I would suggest removing the client notification to not break anyone and just mark the stacktrace op deprecated in the docs. WDYT?
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.
Fair point about some clients probably not supporting this (I'm surprised we forgot to add it to CIDER :D ), so I guess we can just rely on a deprecation in the docs.
project.clj
Outdated
@@ -8,7 +8,8 @@ | |||
:url "http://www.eclipse.org/legal/epl-v10.html"} | |||
:scm {:name "git" :url "https://github.com/clojure-emacs/cider-nrepl"} | |||
:dependencies [[nrepl "1.0.0"] | |||
^:inline-dep [cider/orchard "0.10.0" :exclusions [com.google.code.findbugs/jsr305 com.google.errorprone/error_prone_annotations]] | |||
^:inline-dep [cider/orchard "0.0.0" :exclusions [com.google.code.findbugs/jsr305 com.google.errorprone/error_prone_annotations]] |
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.
What's 0.0.0?
(sorry if I missed it from a possible previous conversation)
Normally, locally I just run make install
on the Orchard project and I still get to use 0.10.0 (i.e. the unaltered version) with local changes applied
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, that was a mistake. Yeah, this was me trying this locally. I changed it back.
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.
Or actually I bumped it to the next orchard version.
This commit changes the Mr Anderson project prefix from cider.nrepl.inlined-deps to cider.nrepl.inlined.deps. This avoids issues with renaming fully qualified record references. See benedekfazekas/mranderson#73
396c48a
to
cce1aac
Compare
After merging it I noticed we forgot to update the changelog. |
It also seems to me you've updated |
Oops, I opened another PR to address those issues: #762 |
This PR adds Stacktrace at point or in region support.
Please see: clojure-emacs/orchard#164
Before submitting a PR make sure the following things have been done: