diff --git a/cider-interaction.el b/cider-interaction.el index 89b2a318e..ec0e0253d 100644 --- a/cider-interaction.el +++ b/cider-interaction.el @@ -137,7 +137,7 @@ which will use the default REPL connection." "inspect-start" "inspect-refresh" "inspect-pop" "inspect-push" "inspect-reset" "macroexpand" "macroexpand-1" "macroexpand-all" - "stacktrace" "toggle-trace") + "resource" "stacktrace" "toggle-trace") "A list of nREPL ops required by CIDER to function properly. All of them are provided by CIDER's nREPL middleware(cider-nrepl).") @@ -626,6 +626,17 @@ exists) is added as a prefix to LOCATION." (interactive "P") (cider-read-symbol-name "Symbol: " 'cider-jump-to-def query)) +(defun cider-jump-to-resource () + "Jump to resource file at point." + (interactive) + (cider-ensure-op-supported "resource") + (let ((resource (thing-at-point 'filename))) + (-when-let (resource-path (plist-get (nrepl-send-request-sync + (list "op" "resource" + "name" resource)) :value)) + (ring-insert find-tag-marker-ring (point-marker)) + (find-file resource-path)))) + (defalias 'cider-jump-back 'pop-tag-mark) (defvar cider-completion-last-context nil) diff --git a/cider-mode.el b/cider-mode.el index 3add6d2ae..be3980a4a 100644 --- a/cider-mode.el +++ b/cider-mode.el @@ -91,6 +91,7 @@ ["Macroexpand-all last expression" cider-macroexpand-all] "--" ["Jump to source" cider-jump] + ["Jump to resource" cider-jump-to-resource] ["Jump back" cider-jump-back] "--" ["Display documentation" cider-doc]