cider

A channel dedicated to the Clojure Interactive Development Environment that Rocks (aka CIDER). :cider:
theeternalpulse 2020-11-05T06:18:13.365900Z

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.

Louis Kottmann 2020-11-05T10:17:51.366300Z

in cider you have cider-macroexpand-(1|all)

Louis Kottmann 2020-11-05T10:18:08.366800Z

otherwise in the REPL you can just (macroexpand 'myform)

devn 2020-11-05T21:34:29.367500Z

hello friends. how do I find all usages of a particular fn definition?

devn 2020-11-05T21:54:08.368100Z

I was thinking C-c C-? r

devn 2020-11-05T21:57:52.369100Z

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

dpsutton 2020-11-05T22:06:40.369700Z

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

devn 2020-11-05T22:28:11.370600Z

normally i’m not jealous of of Cursive, but I’m wondering how people do “Find Usages” in emacs/cider land

bozhidar 2020-11-08T08:06:45.407300Z

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. 😄

devn 2020-11-05T22:29:51.372500Z

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

dpsutton 2020-11-05T22:32:20.372700Z

can't recommend lsp enough

dpsutton 2020-11-05T22:32:56.373200Z

if you're consistent with your imports its also often easy to look for alias/var-name to find them as well

devn 2020-11-05T23:12:20.373800Z

@dpsutton cheers. i’ve been hearing about lsp for ages, but haven’t taken the plunge. do you have any suggested reading?

devn 2020-11-05T23:12:31.374100Z

im using a pretty stock emacs setup + cider

dpsutton 2020-11-05T23:12:59.374600Z

me too. i think there's some good stuff in the readme for lsp

devn 2020-11-05T23:13:02.374700Z

and is it complementary to CIDER, or a replacement? i guess i’ve always been a bit confused

devn 2020-11-05T23:13:16.375100Z

my former coworker wrote clojure-lsp. should have asked him when he was around 😄

dpsutton 2020-11-05T23:13:24.375300Z

https://github.com/snoe/clojure-lsp#emacs

dpsutton 2020-11-05T23:13:35.375600Z

you worked with snoe?

devn 2020-11-05T23:13:45.375900Z

ya

dpsutton 2020-11-05T23:14:03.376300Z

complimentary to CIDER. or at least that's how i used it. it offers no repl.

dpsutton 2020-11-05T23:14:14.376600Z

ah cool. i was at aclaimant until about a month ago with him

devn 2020-11-05T23:14:36.377100Z

nice. i was at outpace with him about 5 years ago. came back to outpace a couple years ago after he’d moved on.

dpsutton 2020-11-05T23:15:07.377600Z

ahh i've heard them talk about it

devn 2020-11-05T23:31:50.378Z

@dpsutton so do you have clojure-lsp running with emacs?

dpsutton 2020-11-05T23:32:11.378300Z

i did but not at my new job

dpsutton 2020-11-05T23:33:06.378800Z

(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 lsp

devn 2020-11-05T23:36:06.379200Z

and then when you enter a cl[j/jc/js] file how do you start it?

devn 2020-11-05T23:36:49.379800Z

i added lsp-mode and configured it like the README suggests, and put the clojure-lsp binary on my PATH

devn 2020-11-05T23:39:43.380500Z

I see you require lsp-clojure — where does that come from?

dpsutton 2020-11-05T23:40:25.381100Z

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

devn 2020-11-05T23:44:33.381400Z

hrmmm, doesn’t seem to be starting or hooking in for some reason

dpsutton 2020-11-05T23:45:35.381800Z

was the buffer already open when you evaluated the use-package form above?

devn 2020-11-05T23:45:51.382Z

nah im restarting emacs to make sure

dpsutton 2020-11-05T23:46:10.382200Z

not sure then.

devn 2020-11-05T23:46:15.382400Z

I do see lsp-log in my buffers

devn 2020-11-05T23:46:18.382600Z

The following clients were selected based on priority: (server-id clojure-lsp, priority 0)

devn 2020-11-05T23:48:14.382900Z

I keep getting “no language servers associated with this buffer”