英文:
Refactor code into a subfunction in VS Code
问题
如果它们是VS Code中的内置功能或扩展,以将任何选定的代码重构为子函数?或者至少分析代码并显示所有需要提供为函数参数的依赖项/变量。我知道Pycharm有这样的功能。
我的最低目标是提前看到创建子函数需要多少工作量,或者是否有意义(而不需要提供大量参数)。
我在谈论Python。
英文:
If they're a built-in function or extension in VS Code to refactor any selected code into a subfunction? Or at least to analyse the code and show all dependencies/variables that would need to be provided as function parameters. I know such a functionality from Pycharm.
My least goal would be to see in advance how much effort it would be to create a subfunction - or if it is meaningful at all (without providing dozens of parameters).
I am talking about Python.
答案1
得分: 1
你可以阅读有关Python 重构的文档。
Python 扩展添加了以下重构功能:提取变量、提取方法和重命名模块。它还支持实现附加重构功能的扩展,如排序导入。
在选择代码后,您可以单击左侧的黄色灯泡来进行自动重构。
英文:
You can read document about Python Refactoring.
The Python extension adds the following refactoring functionalities: Extract Variable, Extract Method and Rename Module. It also supports extensions that implement additional refactoring features such as Sort Imports.
After selecting the code, you can click on the yellow light bulb on the left to automatic refactoring.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论