【问题标题】:Make the VS Code move the curly brace to the next line automatically使 VS Code 自动将大括号移动到下一行
【发布时间】:2019-12-31 17:49:49
【问题描述】:

是否可以让 VS Code 自动将大括号移到下一行?

例如在这段代码中:

namespace MyNamesp
{
    public class Configuration {

    }
}

我希望代码格式如下:

namespace MyNamesp
{
    public class Configuration 
    {

    }
}

当我输入这个时尽快:

namespace MyNamesp
{
    public class Configuration {}
}

{} 之间按下(或不按下,我不关心这个)Enter

现在为了实现这种格式,我必须选择整个文档 (Ctrl + A) 并单击 Alt + Shift + 'F'。

【问题讨论】:

标签: c# visual-studio-code


【解决方案1】:

我认为,如果您打开文本编辑器的“类型格式”和“粘贴格式”设置会有所帮助。如果需要,您还可以打开“保存时格式化”。

我建议您输入namespace MyNamesp,然后按Enter,然后按{,然后按Enter 以获得您想要的。你不应该在例如之后输入spaceConfiguration 如果你想在换行符上打开大括号,你应该输入Enter

【讨论】:

    猜你喜欢
    • 2022-01-13
    • 1970-01-01
    • 2020-02-12
    • 2023-01-10
    • 1970-01-01
    • 2020-05-05
    • 2021-09-15
    • 2022-01-16
    • 1970-01-01
    相关资源
    最近更新 更多