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

**URL:** https://clojureverse.org/t/building-a-tool-for-refactoring-renaming-namespaces-moving-functions/5216
**Category:** General Questions
**Created:** [December 16, 2019, 7:56am UTC](https://clojureverse.org/t/building-a-tool-for-refactoring-renaming-namespaces-moving-functions/5216 "2019-12-16T07:56:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![witek](https://clojureverse.org/user_avatar/clojureverse.org/witek/32/4714_2.png) [@witek](https://clojureverse.org/u/witek)
#### Post date: [December 16, 2019, 7:56am UTC](https://clojureverse.org/t/building-a-tool-for-refactoring-renaming-namespaces-moving-functions/5216/1 "2019-12-16T07:56:01Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![borkdude](https://clojureverse.org/user_avatar/clojureverse.org/borkdude/32/306_2.png) [@borkdude](https://clojureverse.org/u/borkdude)
#### Post date: [December 16, 2019, 8:30am UTC](https://clojureverse.org/t/building-a-tool-for-refactoring-renaming-namespaces-moving-functions/5216/2 "2019-12-16T08:30:32Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![teodorlu](https://clojureverse.org/user_avatar/clojureverse.org/teodorlu/32/2896_2.png) [@teodorlu](https://clojureverse.org/u/teodorlu)
#### Post date: [December 16, 2019, 8:31am UTC](https://clojureverse.org/t/building-a-tool-for-refactoring-renaming-namespaces-moving-functions/5216/3 "2019-12-16T08:31:07Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [June 15, 2020, 8:31pm UTC](https://clojureverse.org/t/building-a-tool-for-refactoring-renaming-namespaces-moving-functions/5216/4 "2020-06-15T20:31:08Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
