Pylance-release: Refactoring: move module member to different module

Created on 7 Jun 2020  路  3Comments  路  Source: microsoft/pylance-release

Related existing issues: microsoft/vscode-python#4628

Same feature as described on this PyCharm documentation page:
https://www.jetbrains.com/help/pycharm/move-refactorings.html#move_module_members

Would be used as such:

  • Select variable or function foo
  • Press shortcut or select "Move" action
  • Select an existing destination module bar.py
  • The imports of foo across the whole project are updated to reflect the change

I'm creating a new feature request since microsoft/vscode-python#4628 seems to focus on the file renaming refactoring feature.

enhancement

Most helpful comment

I consider Move Refactorings (and Changing Signature) a fundamental functionality for every developer working on any non-trivial codebase. I've been a long term PyCharm user but I always give a try to VS Code once in a while to see if it is ready to be my primary IDE. Unfortunately lack of this sends me again back to PyCharm.

I'm also not sure if votes on this issue are the right measure of its importance. I think many developers who give VS Code a try but then are not able to do basic stuff which they are used to do easily in other IDEs like PyCharm just give up and go back to their IDE without digging deep into issues on GitHub in multiple different repos. It took me quite a while to land on this page.

All 3 comments

Thank you for the suggestion! We have marked this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 馃憤 votes the opening comment gets to help us make our decision.

I consider Move Refactorings (and Changing Signature) a fundamental functionality for every developer working on any non-trivial codebase. I've been a long term PyCharm user but I always give a try to VS Code once in a while to see if it is ready to be my primary IDE. Unfortunately lack of this sends me again back to PyCharm.

I'm also not sure if votes on this issue are the right measure of its importance. I think many developers who give VS Code a try but then are not able to do basic stuff which they are used to do easily in other IDEs like PyCharm just give up and go back to their IDE without digging deep into issues on GitHub in multiple different repos. It took me quite a while to land on this page.

I also consider this a very useful feature. I can't really list the use cases of this except for when I realize that a method/function that is already working properly would be better suited residing in another class/module, but changing all of its usages in the code would be really tedious and error-prone.

Right now I do it by using the Ctrl + Shift + H functionality (Replace in Project), but having a foolproof, automated way would be awesome.

Was this page helpful?
0 / 5 - 0 ratings