Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-287798: Surround With Region Should Not Reformat Code

$
0
0
Reporter Damian Powell (damianpowell) Damian Powell (damianpowell)
Created Jan 16, 2012 4:06:01 PM
Updated Jan 16, 2012 4:06:01 PM
Priority Normal
Type Unspecified
Fix versions No Fix versions
State Submitted
Assignee Unassigned
Subsystem No subsystem
Affected versions No Affected versions
Fixed in build No Fixed in build
I often user Surround With Region to hide Fields and ctors in my C# classes. I also align member variable declarations and parameters like so:

Correctly Formatted
public class Foo
{
    private readonly int            bar;
    private readonly string         baz;
    private readonly SomeOtherClass quux;

    public Foo(int bar, string baz, SomeOtherClass quux)
    {
        this.bar  = bar;
        this.baz  = baz;
        this.quux = quux;
    }
}


If I select the fields and constructor and use "Surround With #region" to hide them in a region block, the code is reformatted as shown below. Other 'Surround With' commands (including '#if..#endif') do not reformat the code.

Incorrectly Formatted
public class Foo
{
    #region Fields & ctors

    private readonly int bar;
    private readonly string baz;
    private readonly SomeOtherClass quux;

    public Foo(int bar, string baz, SomeOtherClass quux)
    {
        this.bar = bar;
        this.baz = baz;
        this.quux = quux;
    }

    #endregion
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>