【问题标题】:Making paragraphs for the outline using comments in vscode使用 vscode 中的注释为大纲制作段落
【发布时间】:2022-01-09 01:26:24
【问题描述】:
是否可以使用 cmets 将代码组织在大纲中可用的段落中。
这将有助于组织具有很多方法的类。
我对在 python 类中这样做特别感兴趣。
例子:
class Class():
# Special comment to be in the outline: First methods
def a(self):
pass
def b(self):
pass
def c(self):
pass
# Special comment to be in the outline: Other methods
def d(self):
pass
def e(self):
pass
大纲应根据特殊注释对功能进行分组
谢谢!
【问题讨论】:
标签:
python
visual-studio-code
code-organization
【解决方案1】:
vscode 支持 python 的#regions,这使得使用装订线中的轮廓标记折叠和展开区域成为可能。这些区域不会出现在边栏中的大纲中。 vscode issues for outlines 中已经进行了讨论,但它似乎没有任何很快实施的危险。
这是#region 示例
class Class():
#region Special comment to be in the outline: First methods
def a(self):
pass
def b(self):
pass
def c(self):
pass
#endregion
#region Special comment to be in the outline: Other methods
def d(self):
pass
def e(self):
pass
#endregion