This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-25
Channels
- # aleph (18)
- # announcements (7)
- # asami (18)
- # babashka (15)
- # babashka-sci-dev (79)
- # beginners (61)
- # calva (4)
- # clj-kondo (23)
- # cljfx (16)
- # cljs-dev (6)
- # clojure (63)
- # clojure-bay-area (3)
- # clojure-europe (33)
- # clojure-nl (1)
- # clojure-survey (4)
- # clojure-uk (5)
- # clojurescript (37)
- # conjure (1)
- # cursive (8)
- # datahike (7)
- # datalevin (1)
- # datomic (30)
- # emacs (10)
- # events (2)
- # figwheel (2)
- # fulcro (20)
- # google-cloud (1)
- # lsp (6)
- # luminus (4)
- # malli (5)
- # music (3)
- # nextjournal (1)
- # off-topic (9)
- # other-languages (3)
- # pathom (16)
- # polylith (34)
- # re-frame (14)
- # reagent (19)
- # releases (6)
- # sci (2)
- # shadow-cljs (33)
hi there folks. I'm looking for a mechanism to switch buffers/files by namespace rather than file. I use doom with ivy+projectile and use the projectile-find-file
to hop around the codebase. But I'd much rather browse at the namespace level than the file. Any idea if there's some combo of cider/lsp that can make this happen? Or maybe let me open the question more: how do you browse around namespaces ?
This isn’t quite what you are looking for, but I have a snippet that sets the names of Clojure buffers to the namespace, rather than the file:
(defun tc/rename-buffer-to-ns ()
(interactive)
(when (buffer-file-name)
(let ((ns (clojure-expected-ns)))
(when (not (string= "" ns))
(rename-buffer ns)))))
(add-hook 'clojure-mode-hook 'tc/rename-buffer-to-ns)
Handy for navigating buffers once they’re open, but doesn’t really address the problem of finding files
helm-lsp-workspace-symbol
looks very useful, lists namespaces and symbols in those namespaces (I assume this is similar to consult-lsp-symbols)
Otherwise, I either jump to definition if the namespace or function is used in the current buffer (and easy to jump the cursor too)
Mostly I use projectile find file - fuzzy matching of the pattern means _ characters can be skipped (as can most of the name), so narrowing by namespace name would be the same pattern as use with filenames anyway.
cider-browse-ns
could be used, although I believe it only lists loaded namespaces and requires navigating through a document popup that contains a link to the namespace file. Much more fiddly.
oh, and there is cider-find-ns
which lists all loaded (evaluated) namespaces in the current project. This seems to be what the original ask was (assuming the namespaces are all loaded in the running REPL)