Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Remove and Exclude when refactoring with PyCharm?

The official PyCharm docs explain Exclude when it comes to refactoring: One can, say, rename something with refactoring (Shift+F6), causing the Find window to pop up with a Preview. Within, it shows files which will be updated as a result of the refactor. One can right-click on a file or folder in this Preview and choose Remove or Exclude. What's the difference?

like image 722
hamx0r Avatar asked Mar 26 '16 19:03

hamx0r


People also ask

What does refactor do in PyCharm?

The most popular refactorings supported in PyCharm Makes sure that you do not delete files that are referenced in your source code. Copies/Moves an element. These refactoring actions help you reduce the code duplication. Renames an element.

How do you refactor variables in PyCharm?

Press Shift+F6 or from the main menu, select Refactor | Rename. You can perform the rename refactoring in-place or press Shift+F6 again to open the Rename dialog. Enter a new name of the element to enable the Preview and Refactor buttons. You can specify additional options.

How do I undo refactoring in Intellij?

If you need to undo your refactoring, press Ctrl+Z .

How do I move files in PyCharm?

Move a file or a directory to another directory Select the file or directory in the Project tool window. From the main menu or the editor context menu, choose Refactor | Move or press F6 . In the To directory field, specify the folder to move the selected file or folder to.


1 Answers

Final effect is the same - entry which was Removed or Excluded won't be refactored, the difference is in presentation. After selecting Exclude you keep entry in the Refactoring Preview, but Remove deletes it from that window.

I think that Remove could be useful when you deal with quite large refactoring and marking everything as excluded could lead to unreadable mess.

Keep in mind, that remove action can't be undone - you have to start new refactoring...

like image 54
pocza Avatar answered Sep 20 '22 04:09

pocza