Refactoring: move module member to different module #2620
Replies: 20 comments 22 replies
-
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. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
I believe people at Microsoft don't use VSCode at all... It is just impossible to be productive without refactorings, good auto complete, real auto import, and many other things. If you work without that stuff, dude.... download some pro tools and try them off to get inspired! |
Beta Was this translation helpful? Give feedback.
-
not sure what you're on about, but Pylance has most of the stuff you mentioned |
Beta Was this translation helpful? Give feedback.
-
Hi @disrupted, do you call this real auto import? CleanShot.2021-10-13.at.12.32.34.mp4It works in some cases where related stuff gets indexed, other way it won't work. |
Beta Was this translation helpful? Give feedback.
-
Can you please try enabling indexing with this?
For user code, see also #1055. |
Beta Was this translation helpful? Give feedback.
-
@jakebailey I'm experiencing the same behavior as @cperezabo and I have enabled the indexing option long time ago (although when I checked it now, it says When I use some object from my workspace, at first I have to use |
Beta Was this translation helpful? Give feedback.
-
For auto-import completions from symbols in your workspace, that is explicitly #1055; I would comment there. It's expected at the moment for auto-imports from the workspace to work only on quick fixes, though we'd like to change that, which is what #1055 is all about. This thread is about refactorings; I'd rather we continue conversations about auto imports in the right issue. |
Beta Was this translation helpful? Give feedback.
-
@jakebailey, that doesn't work, I already tried it some time ago, at least not in the expected way. |
Beta Was this translation helpful? Give feedback.
-
Any updates on this? Not being able to refactor is a huge obstacle. |
Beta Was this translation helpful? Give feedback.
-
@bjarkemoensted we started doing incremental rollout for module rename refactoring. member move is being worked on. still require more work. |
Beta Was this translation helpful? Give feedback.
-
@cperezabo @hmoravec if you can open your own issue with issues you are having, it would be easier for us to track and address the issues. and leave this issue for the refactoring. |
Beta Was this translation helpful? Give feedback.
-
Any updates? |
Beta Was this translation helpful? Give feedback.
-
Seems like this is already available in the JS and TypeScript extensions of VSCode, maybe that could be looked to for help? This is one of the biggest current downsides to switching from |
Beta Was this translation helpful? Give feedback.
-
Is there any update on this topic? I don't understand why this is not yet implemented. It's evident that the need of this feature is critical for all the developers, but it seems that there's no work towards solving that 😢 |
Beta Was this translation helpful? Give feedback.
-
it was blocked by some infrastructure work. about 70% done. work will be resumed soon. |
Beta Was this translation helpful? Give feedback.
-
Recent news on Python move (between modules) refactoring? |
Beta Was this translation helpful? Give feedback.
-
Hey folks, this is now available in the latest pre-release version of the Pylance extension. You can set |
Beta Was this translation helpful? Give feedback.
-
I've done a few manual attempts of the basic cases and the pre-release seems to work pretty well on moving a single thing! The import rewriting is appreciated as well. It doesn't clean up the old imports every time, but it's something that pylance does flag and is easy-enough to remove with auto-fixes from import cleaning up logic (ALA ruff).
|
Beta Was this translation helpful? Give feedback.
-
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:
foo
bar.py
foo
across the whole project are updated to reflect the changeI'm creating a new feature request since microsoft/vscode-python#4628 seems to focus on the file renaming refactoring feature.
Beta Was this translation helpful? Give feedback.
All reactions