Resharper 大括号自动格式化

发布于 2024-10-05 04:58:25 字数 1105 浏览 0 评论 0原文

我对 Resharper 和自动格式化大括号有疑问。 有一段时间,当我输入左大括号时,Resharper 不再添加右大括号。 此外,当我在方法的最后一行键入右大括号时,该方法的右大括号将被删除。

示例:

private void Method()
{
    if(true)
    { // If I type '{' resharper of vs2010 will normally add a '}' 
      // but I don't know why not now
}
private void AnotherMethod(){}

如果 am am 手动添加右大括号,则该方法的右大括号将被删除,并且 AnotherMethod() 会缩进。

private void Method()
{
    if(true)
    {
    } // Why is the closing brace of the method removed?
    private void AnotherMethod(){}

我的resharper的相关设置:
格式样式>大括号布局
- 大括号布局:适用于所有在下一行(BSD 样式)(以及空大括号格式:在不同行 )
- 强制大括号:对于所有添加大括号

IntelliSence >完成行为
- 启用:完成后自动插入括号
+- 选择:打开和关闭

编辑器
- 启用:自动插入右大括号
+-已选择:在输入左大括号时

解决此问题所需的 resharper 设置是什么?

I have a problem with Resharper and auto formating braces.
Since a while Resharper don't add closing braces while I am typing an opening brace.
Also when I am typing a closing brace at the last line of a method, the closing brace of the method will be removed.

Example:

private void Method()
{
    if(true)
    { // If I type '{' resharper of vs2010 will normally add a '}' 
      // but I don't know why not now
}
private void AnotherMethod(){}

If am am manually add the closing brace the closing brace of the method is removed and AnotherMethod() is indented.

private void Method()
{
    if(true)
    {
    } // Why is the closing brace of the method removed?
    private void AnotherMethod(){}

My related settings of resharper:
Formatting style > Braces Layout:
- Braces Layout: for all At next line (BSD style) (and Empty braces formatting: On different lines)
- Force Braces: for all Add braces

IntelliSence > Completion Behavior:
- Enabled: Automatically insert parentheses after completion
+- selected: Both opening and closing

Editor
- Enabled: Auto-insert closing brace
+-selected: On typing an opening brace

What are the required resharper settings to solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文