Rename refactor issues

When I try to do a rename refactoring of a method, and I bring up the extra options, and click the Preview button, sometimes nothing happens. Is there a way I can see if it is still trying to do something in the background or if an error occurred?

In that particular case, the method I was renaming is not used in many places, so it is not a very large refactoring job to do. However, I recently tried doing a different, very large refactoring of renaming a namepace/directory. The experience wasn't very good. I was able to do a preview of what it would refactor. I was impressed by all the cases it found that it should refactor. When I told it to do the refactor, there was no indication of if it was done or not. Since this was a very large refactoring job, I didn't expect it to complete very quickly. When I examined the changed files, only a few things got changed, it didn't actually change everything that the preview said it would change. But there was also no error popups or obvious indications of a problem, it just acted like it had done the refactoring and all was good.

What are some general tips to get refactoring to work correctly in PhpStorm? Do I need to have things setup a certain way in advance before it will work more reliably? Are there any tricks to get it to be more reliable or to diagnose and fix issues like this?

0
3 comments

The first described issue is reported as https://youtrack.jetbrains.com/issue/WI-39662 - feel free to give it a vote.

The second one seems to be more complicated & I can't find anything massively reported on that topic.

Were you checking the renaming process by opening files externally (e.g. in notepad)? This might be bad since IDE uses temporary files to store changes: if you open a file in notepad you might see the file state being different from the state in IDE.

0
Avatar
Permanently deleted user

Thanks Dmitry. As for my second issue, even if the IDE uses temporary files, at some point it would have to actually rename things in the real files right? I used `git status` and `git diff` from the built in terminal to see what files changed and what changes had been made. That is part of the problem though because I wasn't sure how to long to wait before checking since there was no indication of if the rename ever really started or finished.

0
Avatar
Permanently deleted user
0

Please sign in to leave a comment.