-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: move function to new namespace #817
Comments
Yes, this is definitely on the list. It's tricky, no doubt, and there are lots of details to get right. But this is one refactoring I'd really love to have, for whatever reason I do this a lot myself. |
+1 |
This is the number one feature that I miss from Java/Scala devel. I refactor aggressively, and stuff moves around a lot. Very tedious to do by hand. |
Dupe of #90. |
+1 |
danielcompton, I do not believe this is a dupe of #90. If you look at the dependency tree of the namespaces in a project and say you're at the root of that tree and want to extract a function in the root namespace to a dependency of the root then the updates in the source code only have to happen to the current namespace. If however, the function is in a dependency of the root and you wish to make a lateral move to another dependency then updates to calls must be made throughout the entire project. So it depends on how the solution to #90 was implemented as to whether this issue is a duplicate. But logically, #90 is a subset of this issue and this issue is more general. +1 to this issue. |
almost a year old - will this get any attention soon? am always missing this feature when I'm in refactoring mode. |
+1 🙏 |
+1 <3 |
+1 🙏 |
+1 🙏🙏🙏🙏🙏🙏🙏 |
Is there any progress on this? |
How's this coming along? |
+1 |
I'd like to contribute the idea/observation that this isn't a IDE-specific functionality. Even if this was implemented in Cursive:
Solutions like https://github.com/clojure-emacs/refactor-nrepl, https://github.com/xsc/rewrite-clj, the clj-kondo line of solutions, etc are a Thing™. Often they offer a public API, and don't require a tremendously different skillset than that associated to vanilla Clojure development. So, quite feasibly, one could author a vanilla Clojure program with the following API: (move! #'origin.ns/foo 'destination.ns/bar) Such a program could be invoked from the repl, or from a task runner for extra cleanliness ( I've been wanting to author myself such a helper but honestly I lack the time and am engaged in enough clj side-projects already. If anyone around would like to give it a shot, you might have luck proposing it in https://github.com/clj-commons/meta or such, maybe with an accompanying POC. I could offer a bit of help (as I've hacked quite a lot with refactor-nrepl et al) if appreciated. |
I would love an easy way to move a function to a new namespace, and update all callers within the current project. I've been doing this manually and it can be quite tedious!
Ideally, it would identify which other functions need to be carried along as well to make the function compile in its new home, and perhaps update the (ns) of the new namespace with any additional requires or imports.
Tricky, tricky stuff to be sure!
The text was updated successfully, but these errors were encountered: