This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-18
Channels
- # ai (2)
- # announcements (11)
- # beginners (34)
- # biff (14)
- # clerk (14)
- # clj-kondo (25)
- # clojure (27)
- # clojure-austin (1)
- # clojure-conj (6)
- # clojure-denmark (1)
- # clojure-europe (20)
- # clojure-hamburg (1)
- # clojure-nl (1)
- # clojure-norway (28)
- # clojure-uk (2)
- # clojuredesign-podcast (6)
- # clojurescript (43)
- # cursive (4)
- # data-science (2)
- # emacs (9)
- # hyperfiddle (9)
- # introduce-yourself (2)
- # jobs (3)
- # lsp (32)
- # missionary (31)
- # nbb (8)
- # off-topic (23)
- # rdf (23)
- # re-frame (10)
- # reitit (11)
- # releases (3)
- # rewrite-clj (4)
- # shadow-cljs (7)
- # specter (6)
- # sql (7)
- # xtdb (7)
I want to take a namespace file and rewrite symbols that point to vars that are referred from a particular namespaces to use an alias. (so replacing instances of map-vals with m/map-vals for example) I think I need a tools.analyzer ast to find the symbol/var pairs being used, but then I think I want something like rewrite-clj to emit the changes to the source code as a string. Is there a way to pair a tools.analyzer AST with the rewrite-clj AST? I vaguely remember seeing something like that.
@U064UGEUQ You can do this using clj-kondo (although you could probably use tools analyzer) and rewrite-clj. The way to do this is use the clj-kondo analysis output and then compare it to the location of the rewrite-clj nodes. A demo of applying this is here: