Building a tool for refactoring (renaming namespaces / moving functions)

Since there is no IDE which can rename namespaces and move functions while updating references in multiple projects for clj+cljc+cljs, I would like to try building this.

I have identified these problems so far:

  • Load multiple source directories
  • Parse clj+cljc+cljs while keeping comments, whitespace, formating
  • Resolve and index all references
  • Determine the correct destination folder for any given (new) namespace
  • Determine the correct destination position in a file for any moved-in function
  • Create data which describes all the actions so it can be displayed (and modified) before execution

I hope rewrite-clj works on all file types and I can utilize it. This is where I would start investigating.

Do you have any suggestions what else to think about before starting to tackle this problem? Or which existing libraries would help? Thank you.


Going into the #rewrite-clj channel on Clojurians Slack would be good if you want to know more about that. There is an in-progress project called rewrite-cljc which will combine rewrite-clj and rewrite-cljs into one project, so it can be called from both Clojure and ClojureScript.


I don’t have any suggestions, but I appreciate the effort!

The ability to do advanced refactoring is one of the aspects of Java / C# I really appreciate, and I’ve missed being able to do that in Clojure. Note that I haven’t really put a lot of effort into understanding what CIDER already can do with regards to refactoring.