Skip to content

Commit 65cf5a0

Browse files
author
Ryan Smith
committed
Clean symbol before doing look up
If you attempt to run `cider-jump-to-var` to find the definition of an atom dereferenced with `@`, cider can't find the source location. If you remove the `@` cider has no issues finding the location. This allows for cleaning non-variable components out of a symbol before doing the look up to prevent this issue.
1 parent 32c2979 commit 65cf5a0

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

cider-client.el

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ unless ALL is truthy."
146146
(when (and class member)
147147
(cider-sync-request:info nil class member)))
148148

149+
(defun cider--clean-symbol (symbol)
150+
"Return SYMBOL cleaned so a dictionary match can be found."
151+
(let* ((symbol (if (string-equal (substring symbol 0 1) "@")
152+
(substring symbol 1)
153+
symbol)))
154+
symbol))
155+
149156

150157
;;; Requests
151158

@@ -200,13 +207,14 @@ loaded. If CALLBACK is nil, use `cider-load-file-handler'."
200207

201208
(defun cider-sync-request:info (symbol &optional class member)
202209
"Send \"info\" op with parameters SYMBOL or CLASS and MEMBER."
203-
(let ((var-info (-> `("op" "info"
204-
"session" ,(nrepl-current-session)
205-
"ns" ,(cider-current-ns)
206-
,@(when symbol (list "symbol" symbol))
207-
,@(when class (list "class" class))
208-
,@(when member (list "member" member)))
209-
(nrepl-send-sync-request))))
210+
(let* ((symbol (cider--clean-symbol symbol))
211+
(var-info (-> `("op" "info"
212+
"session" ,(nrepl-current-session)
213+
"ns" ,(cider-current-ns)
214+
,@(when symbol (list "symbol" symbol))
215+
,@(when class (list "class" class))
216+
,@(when member (list "member" member)))
217+
(nrepl-send-sync-request))))
210218
(if (member "no-info" (nrepl-dict-get var-info "status"))
211219
nil
212220
var-info)))

0 commit comments

Comments
 (0)