Skip to content
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

cider-jump-to-locref-at-point: don't jump to non-existing files #3540

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
- [#2903](https://github.com/clojure-emacs/cider/issues/2903): Avoid `No comment syntax is defined` prompts.
- Bump the `clojure-mode` required version to [5.18.0](https://github.com/clojure-emacs/clojure-mode/blob/v5.18.0/CHANGELOG.md#5180-2023-10-18)

### Bugs fixed

- [#3539](https://github.com/clojure-emacs/cider/issues/3539): `cider-jump-to-locref-at-point`: don't jump to non-existing files.

## 1.8.2 (2023-10-15)

### Changes
Expand Down
25 changes: 12 additions & 13 deletions cider-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -1401,21 +1401,20 @@ regexes from `cider-locref-regexp-alist' to infer locations at point."
(nrepl-dict-get (cider-sync-request:info var) "file")))
(when-let* ((file (plist-get loc :file)))
;; 2) file detected by the regexp
(or
(if (file-name-absolute-p file)
file
;; when not absolute, expand within the current project
(when-let* ((proj (clojure-project-dir)))
(let ((path (expand-file-name file proj)))
(when (file-exists-p path)
path))))
;; 3) infer ns from the abbreviated path (common in
;; reflection warnings)
(let ((ns (cider-path-to-ns file)))
(cider-sync-request:ns-path ns)))))))
(let ((file-from-regexp (if (file-name-absolute-p file)
file
;; when not absolute, expand within the current project
(when-let* ((proj (clojure-project-dir)))
(expand-file-name file proj)))))
(or (when (file-readable-p file-from-regexp)
file-from-regexp)
;; 3) infer ns from the abbreviated path
;; (common in reflection warnings)
(let ((ns (cider-path-to-ns file)))
(cider-sync-request:ns-path ns))))))))
(if file
(cider--jump-to-loc-from-info (nrepl-dict "file" file "line" line) t)
(error "No source location for %s" var)))
(error "No source location for %s - you may need to adjust `cider-locref-regexp-alist' to match your logging format" var)))
(user-error "No location reference at point")))

(defvar cider-locref-hoover-overlay
Expand Down
2 changes: 1 addition & 1 deletion doc/modules/ROOT/pages/usage/dealing_with_errors.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ To open this stacktrace in the Cider stacktrace inspector, move point
somewhere over the exception and run `M-x
cider-stacktrace-analyze-at-point`.

This also works to some extend for exceptions that are buried inside a
This also works to some extent for exceptions that are buried inside a
string like the following exception:

[source,text]
Expand Down
Loading