我在另一个 if else 语句下有多个 if else 语句,我希望能够折叠某个父级下的所有子语句,而不必分别折叠每个子语句,因为它有 100 个。 例如(只是一个通用代码,它可以是任何其他东西):
代码展开
func example(v1: String, v2: Int, v3: Int)
{
if v1 == "Food"
{
if v2 == 2 && v3 == 7
{
// Some Long Lines Codes
}
else if v2 == 2 && v3 == 33
{
// Some Long Lines Codes
}
else if v2 == 44 && v3 == 72
{
// Some Long Lines Codes
}
else if v2 == 12 && v3 == 7
{
// Some Long Lines Codes
}
else if v2 == 102 && v3 == 97
{
// Some Long Lines Codes
}
}
}
我想像这样折叠起来,只需轻轻一按,而不是一个一个地折叠
func example(v1: String, v2: Int, v3: Int)
{
if v1 == "Food"
{
if v2 == 2 && v3 == 7
{...}
else if v2 == 2 && v3 == 33
{...}
else if v2 == 44 && v3 == 72
{...}
else if v2 == 12 && v3 == 7
{...}
else if v2 == 102 && v3 == 97
{...}
}
}
成像像其他 100 行,如果我需要使用 CMD + Opt + 手动折叠每一行的条件<- or even using the arrow beside, I hope there is a fast and reliable shortcut or a click to help folding child codes or selected codes
顺便说一句,我知道有一个 cmd + opt + shift + <- to fold all but that's not helping cause when I unfold the function I would see all remains as it was before.
我希望任何人都能有线索,或者是否有能力添加脚本功能来这样做。