Skip to content

Commit 06b0406

Browse files
committed
lsp-ui-find-{next,prev}-reference: pass extra params rather than use filter-fn
1 parent d292641 commit 06b0406

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lsp-ui.el

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,26 +112,26 @@ Both should have the form (FILENAME LINE COLUMN)."
112112
(< (cadr x) (cadr y))
113113
(< (caddr x) (caddr y)))))
114114

115-
(defun lsp-ui--reference-triples (filter-fn)
115+
(defun lsp-ui--reference-triples (extra)
116116
"Return references as a list of (FILENAME LINE COLUMN) triples."
117117
(let ((refs (lsp--send-request (lsp--make-request
118118
"textDocument/references"
119-
(lsp--make-reference-params)))))
119+
(append (lsp--text-document-position-params) extra)))))
120120
(sort
121121
(mapcar
122122
(lambda (ref)
123123
(-let* (((&hash "uri" uri "range" range) ref)
124124
((&hash "line" line "character" col) (gethash "start" range)))
125125
(list (lsp--uri-to-path uri) line col)))
126-
(if filter-fn (--filter (funcall filter-fn it) refs) refs))
126+
refs)
127127
#'lsp-ui--location<)))
128128

129129
;; TODO Make it efficient
130-
(defun lsp-ui-find-next-reference (&optional filter-fn)
130+
(defun lsp-ui-find-next-reference (&optional extra)
131131
"Find next reference of the symbol at point."
132132
(interactive)
133133
(let* ((cur (list buffer-file-name (lsp--cur-line) (lsp--cur-column)))
134-
(refs (lsp-ui--reference-triples filter-fn))
134+
(refs (lsp-ui--reference-triples extra))
135135
(idx -1)
136136
(res (-first (lambda (ref) (cl-incf idx) (lsp-ui--location< cur ref)) refs)))
137137
(if res
@@ -144,11 +144,11 @@ Both should have the form (FILENAME LINE COLUMN)."
144144
(cons 0 0))))
145145

146146
;; TODO Make it efficient
147-
(defun lsp-ui-find-prev-reference (&optional filter-fn)
147+
(defun lsp-ui-find-prev-reference (&optional extra)
148148
"Find previous reference of the symbol at point."
149149
(interactive)
150150
(let* ((cur (list buffer-file-name (lsp--cur-line) (lsp--cur-column)))
151-
(refs (lsp-ui--reference-triples filter-fn))
151+
(refs (lsp-ui--reference-triples extra))
152152
(idx -1)
153153
(res (-last (lambda (ref) (and (lsp-ui--location< ref cur) (cl-incf idx))) refs)))
154154
(if res

0 commit comments

Comments
 (0)