This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aws (5)
- # aws-lambda (1)
- # beginners (133)
- # boot (1)
- # cljsrn (1)
- # clojure (28)
- # clojure-austin (3)
- # clojure-italy (2)
- # clojure-spec (17)
- # clojure-uk (18)
- # clojurescript (38)
- # cursive (6)
- # datomic (6)
- # figwheel (1)
- # graphql (1)
- # klipse (1)
- # leiningen (1)
- # off-topic (13)
- # onyx (30)
- # re-frame (44)
- # reagent (7)
- # shadow-cljs (77)
- # spacemacs (7)
alright... sorry for the rant. I think I got it.
This is applicable for Spacemacs, and maybe to some degree to non-Spacemacs configs.
g d and
, g g in Clojure modes for Spacemacs don't work reliably.
g d works only and only if you are jacked-in. But even then it doesn't work in cljs, cljc files, cider-repl.
and sometimes it prompts for the symbol (it simply wouldn't recognize it) - stupid thing
so, solution? Maybe for whenever cider cannot jump to a definition is to use
dumb-jump ? it is stupidly simple and works in most cases
But that turned out to be not so trivial to set the way so it would work in Spacemacs. Here's how I did it:
(defun clj-find-var () "Attempts to jump-to-definition of the symbol-at-point. If CIDER fails, or not available, falls back to dumb-jump" (interactive) (let ((var (cider-symbol-at-point))) (if (and (cider-connected-p) (cider-var-info var)) (unless (eq 'symbol (type-of (cider-find-var nil var))) (dumb-jump-go)) (dumb-jump-go)))) (with-eval-after-load 'clojure-mode (add-hook 'clojure-mode-hook #'spacemacs//init-jump-handlers-clojure-mode) (add-hook 'clojurescript-mode-hook #'spacemacs//init-jump-handlers-clojurescript-mode) (add-hook 'clojurec-mode-hook #'spacemacs//init-jump-handlers-clojurec-mode) (add-hook 'cider-repl-mode-hook #'spacemacs//init-jump-handlers-cider-repl-mode) (dolist (x '(spacemacs-jump-handlers-clojure-mode spacemacs-jump-handlers-clojurec-mode spacemacs-jump-handlers-clojurescript-mode spacemacs-jump-handlers-clojurex-mode spacemacs-jump-handlers-cider-repl-mode)) (set x '(clj-find-var))))
@ag sweet, I'll give that a try for myself. Wouldn't surprise me if the spacemacs folks would really appreciate that as a PR.
yeah, I will try to get it out, maybe someone smarter than me can help me to fix it better