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?
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.
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.
If you need to undo your refactoring, press Ctrl+Z .
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.
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With