Jump to the frame's own source in stacktraces#4066
Merged
Conversation
Clicking a stack frame for a top-level anonymous function (the deftest pattern) jumped to `clojure.core/fn': `cider-stacktrace-navigate' resolved the frame's `.../fn' var via `cider-var-info', which resolves `fn' to `clojure.core/fn' and clobbers the frame's own (correct) location. The middleware now populates each frame's file-url with a resolved absolute path and an accurate line (verified against current orchard), so prefer that directly and skip the var resolution. Frames without a file-url (e.g. REPL evaluations with NO_SOURCE_FILE) keep the old var/class fallback. The frame button now carries file-url for this.
5f392c3 to
4b0e113
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3157.
Clicking a stack frame for a top-level anonymous function - the shape
deftestexpands to - jumped toclojure.core/fninstead of your code.cider-stacktrace-navigateresolved the frame's.../fnvar viacider-var-info, which resolvesfntoclojure.core/fnand lets its file/line override the frame's own correct location.I reproduced it against current orchard (
orchard.stacktrace/analyzeon the exact repro): the anonymous-fn frame now comes back with a populated:file-url(an absolutefile:path) and an accurate:line- unlike the 2022 dump in the issue where:file-urlwas nil. So the backend already hands us everything needed; the client was just throwing it away (it didn't even capturefile-urloff the frame).The fix: prefer the frame's own
file-url+lineand skip the var re-resolution. Frames without afile-url(REPL evals /NO_SOURCE_FILE) keep the existing var/class fallback with its line-shift. Validated on a multi-line fn that the frame's line points at the throwing line, so no line-shift is needed on the file-url path. Unit tests cover both paths.