@@ -1401,21 +1401,20 @@ regexes from `cider-locref-regexp-alist' to infer locations at point."
14011401 (nrepl-dict-get (cider-sync-request:info var) " file" )))
14021402 (when-let* ((file (plist-get loc :file )))
14031403 ; ; 2) file detected by the regexp
1404- (or
1405- (if (file-name-absolute-p file)
1406- file
1407- ; ; when not absolute, expand within the current project
1408- (when-let* ((proj (clojure-project-dir)))
1409- (let ((path (expand-file-name file proj)))
1410- (when (file-exists-p path)
1411- path))))
1412- ; ; 3) infer ns from the abbreviated path (common in
1413- ; ; reflection warnings)
1414- (let ((ns (cider-path-to-ns file)))
1415- (cider-sync-request:ns-path ns)))))))
1404+ (let ((file-from-regexp (if (file-name-absolute-p file)
1405+ file
1406+ ; ; when not absolute, expand within the current project
1407+ (when-let* ((proj (clojure-project-dir)))
1408+ (expand-file-name file proj)))))
1409+ (or (when (file-readable-p file-from-regexp)
1410+ file-from-regexp)
1411+ ; ; 3) infer ns from the abbreviated path
1412+ ; ; (common in reflection warnings)
1413+ (let ((ns (cider-path-to-ns file)))
1414+ (cider-sync-request:ns-path ns))))))))
14161415 (if file
14171416 (cider--jump-to-loc-from-info (nrepl-dict " file" file " line" line) t )
1418- (error " No source location for %s " var)))
1417+ (error " No source location for %s - you may need to adjust `cider-locref-regexp-alist' to match your logging format " var)))
14191418 (user-error " No location reference at point" )))
14201419
14211420(defvar cider-locref-hoover-overlay
0 commit comments