Skip to content

Commit 208ff9a

Browse files
committed
[Fix #1062] Add completion candidates to cider-find-resource
1 parent f15b610 commit 208ff9a

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
* [#1014](https://github.com/clojure-emacs/cider/issues/1014) A prefix of <kbd>-</kbd> causes `cider-find-var` and
4444
`cider-find-resource` to show results in other window. Additionally, a double prefix argument <kbd>C-u C-u</kbd>
4545
inverts the meaning of `cider-prompt-for-symbol` and shows the results in other window.
46+
* [#1062](https://github.com/clojure-emacs/cider/issues/1062): Added completion candidates to `cider-find-resource`.
4647

4748
### Changes
4849

cider-client.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ loaded. If CALLBACK is nil, use `cider-load-file-handler'."
235235
(nrepl-send-sync-request)
236236
(nrepl-dict-get "resource-path")))
237237

238+
(defun cider-sync-request:resources-list ()
239+
"Perform nREPL \"resource\" op with resource name NAME."
240+
(-> (list "op" "resources-list")
241+
(nrepl-send-sync-request)
242+
(nrepl-dict-get "resources-list")))
243+
238244
(defun cider-sync-request:format-code (code)
239245
"Perform nREPL \"format-code\" op with CODE."
240246
(-> (list "op" "format-code"

cider-interaction.el

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,9 +829,11 @@ value is thing at point."
829829
(interactive
830830
(list
831831
(if (cider--prompt-for-symbol-p current-prefix-arg)
832-
(cider-read-from-minibuffer "Resource: " (thing-at-point 'filename))
832+
(completing-read "Resource: "
833+
(cider-sync-request:resources-list)
834+
nil nil
835+
(thing-at-point 'filename))
833836
(or (thing-at-point 'filename) ""))))
834-
835837
(cider-ensure-op-supported "resource")
836838
(-if-let* ((resource (cider-sync-request:resource path))
837839
(buffer (cider-find-file resource)))

0 commit comments

Comments
 (0)