Skip to content
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

rename-file doesn't rename fully qualified function references #173

Closed
expez opened this issue Oct 20, 2016 · 6 comments · Fixed by #365
Closed

rename-file doesn't rename fully qualified function references #173

expez opened this issue Oct 20, 2016 · 6 comments · Fixed by #365
Labels

Comments

@expez
Copy link
Member

expez commented Oct 20, 2016

I had a with-redefs in my test ns and when I moved the ns with the functions being mocked out the weren't renamed properly.

@expez expez added the bug label Oct 20, 2016
@vemv vemv pinned this issue Nov 8, 2021
@vemv
Copy link
Member

vemv commented Nov 8, 2021

@expez: by any chance you'd like to give a go to this issue and perhaps other related work?

With 622c210, renaming files is working again.

I'm enjoying it already but I suspect there might be missing edge cases here and there e.g. metadata, Clojure's newer syntaxes for ns-qualified things, etc.

Especially since only the updated rewrite-clj has proper support for some of those.

Obviously it's just a suggestion, can give it a shot myself at some point.

@expez
Copy link
Member Author

expez commented Nov 8, 2021

I'm enjoying it already but I suspect there might be missing edge cases here and there e.g. metadata, Clojure's newer syntaxes for ns-qualified things, etc.

This is very likely!

by any chance you'd like to give a go to this issue and perhaps other related work?

I have very limited time for open source work lately, but we do get some time at work to spend on side projects. I've been trying to put that time into refactor-nrepl, but had to cut a new release for superstring last time around.

Will def try to spend more time here. It's for sure more fun now that you're here breathing new life and enthusiasm into the project 🤗

@vemv
Copy link
Member

vemv commented Nov 8, 2021

🍻 thanks for the answer, let's see how it goes!

@vemv
Copy link
Member

vemv commented Nov 8, 2021

I took a look at refactor-nrepl.rename-file-or-dir, it doesn't use rewrite-clj so perhaps I wouldn't push this specific impl much more. string/replace can only buy us so much...

I'd look into integrating clojure-lsp's programmatic api, it doesn't involve running a lsp server at all so we save that complexity.

see e.g. https://cljdoc.org/d/com.github.clojure-lsp/clojure-lsp/2021.11.02-15.24.47/api/clojure-lsp.api#rename! (that renames a symbol, not a file/dir)

As mentioned in some other issue, it's a good idea to introduce a protocol so we all can use what we find best.

@vemv
Copy link
Member

vemv commented Nov 16, 2021

After researching, clojure-lsp is right now bit of a dense dep to pull (it has lots of transitive deps). They're open to a modularization but probably it's not something to expect too soon.

Which invited me to think, refactor-nrepl's string/replace impl isn't so bad after all. In terms of false negatives (should have refactored, didn't refactor) I'd expect them to be absent, even for metadata or fancy constructs.

In terms of false positives (refactored where it shouldn't have: comments, strings, quoted symbols maybe?), those are harder to parse against, OTOH discerning users will review refactor-nrepl's results. That's why VCS, unit tests etc exist :)

So I'd keep/extend the current impl indefinitely, seems good to have something self-contained.

Will give it a shot eventually if nobody else beats me to it 👀

vemv added a commit that referenced this issue Feb 8, 2022
@vemv vemv unpinned this issue Feb 8, 2022
@vemv vemv closed this as completed in #365 Feb 9, 2022
vemv added a commit that referenced this issue Feb 9, 2022
…mespaces (#365)

* `rename-file-or-dir`: rename more kinds of constructs in dependent namespaces

Fixes #173
@vemv
Copy link
Member

vemv commented Feb 10, 2022

Fixed in refactor-nrepl 3.3.2 / clj-refactor.el 3.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants