What's the most I guess effective way to work with macros in clojurescript when connected to the cljs repl? I noticed I can't really eval macros in the clj file so kind doing rapid testing in the same ns while creating it like I would anything else.
in cider you have cider-macroexpand-(1|all)
otherwise in the REPL you can just (macroexpand 'myform)
hello friends. how do I find all usages of a particular fn definition?
I was thinking C-c C-? r
but perhaps I need to load all namespaces for it to work? wondering how people typically do this. I’m looking to check for usages, and then jump through them
CIDER is always nrepl based so its just whatever is in the running instance. clj-refactor might have some tools for this and i know that lsp certainly has tricks for this
normally i’m not jealous of of Cursive, but I’m wondering how people do “Find Usages” in emacs/cider land
I've always found projectile-ag
to yield great results for me, but your mileage might vary. 🙂 CIDER's built-in find-usages functionality works only on loaded namespaces and only for Clojure. clj-refactor
and anacondo-mode might give you better results, as an alternative to using LSP. Too many options these days. 😄
I suppose I’ve always just grepped around, but I’m doing a bunch of reorganization right now. It’s in a project with 3 source dirs: a cljs src dir, a clj src dir, and a cljc shared source dir that is referenced by both the cljs and clj src dirs
can't recommend lsp enough
if you're consistent with your imports its also often easy to look for alias/var-name
to find them as well
@dpsutton cheers. i’ve been hearing about lsp for ages, but haven’t taken the plunge. do you have any suggested reading?
im using a pretty stock emacs setup + cider
me too. i think there's some good stuff in the readme for lsp
and is it complementary to CIDER, or a replacement? i guess i’ve always been a bit confused
my former coworker wrote clojure-lsp. should have asked him when he was around 😄
you worked with snoe?
ya
complimentary to CIDER. or at least that's how i used it. it offers no repl.
ah cool. i was at aclaimant until about a month ago with him
nice. i was at outpace with him about 5 years ago. came back to outpace a couple years ago after he’d moved on.
ahh i've heard them talk about it
@dpsutton so do you have clojure-lsp running with emacs?
i did but not at my new job
(when personal/work-machine
(use-package lsp-mode
:load-path "~/projects/elisp/lsp-mode"
:hook ((clojure-mode . lsp)
(clojurec-mode . lsp)
(clojurescript-mode . lsp))
:init
(setq lsp-enable-completion-at-point nil)
;; (setq indent-region-function #'clojure-indent-function)
:config
(require 'lsp-clojure)
(dolist (m '(clojure-mode clojurec-mode clojurescript-mode))
(add-to-list 'lsp-language-id-configuration `(,m . "clojure")))
(setq lsp-clojure-server-command '("bash" "-c" "cd ~/projects/clojure/clojure-lsp && lein run")
lsp-enable-indentation nil)
;; (add-hook 'clojure-mode-hook #'lsp)
;; (add-hook 'clojurescript-mode-hook #'lsp)
;; (add-hook 'clojurec-mode-hook #'lsp)
))
almost straight out of the readme. i prefer CIDER's completion and not indenting with lspand then when you enter a cl[j/jc/js] file how do you start it?
i added lsp-mode and configured it like the README suggests, and put the clojure-lsp binary on my PATH
I see you require lsp-clojure
— where does that come from?
that's part of lsp emacs package. when you enter a clj/cljc/cljs file it should start due to the hooks in the snippets
hrmmm, doesn’t seem to be starting or hooking in for some reason
was the buffer already open when you evaluated the use-package
form above?
nah im restarting emacs to make sure
not sure then.
I do see lsp-log in my buffers
The following clients were selected based on priority: (server-id clojure-lsp, priority 0)
I keep getting “no language servers associated with this buffer”