Unwanted indentation after Property - feature, bug, misconfiguration or conflict?

When I have a C# class like this:

class Foo
{

    public void M1()
    {
    }
}


And then type the following text on the line above M1:

public int P1 { get { return 0; } }


Then as soon as I type the first closing brace, M1 is indented, and does not become unindented after I type the second closing brace:

class Foo
{
    public int P1 { get { return 0; } }
        public void M1()
    {
    }
}


The behaviour is different if M1 doesn't have an access modifier. In this case, typing the semicolon results in this (cursor location indicated by underscore):

class Foo
{
    public int P1 { get
    {
        return 0;_
    void M1()
    {
    }
}


Then the first closing brace results in this:

class Foo
{
    public int P1 { get { return 0; }_
    void M1()
    {
    }
}


And no further automatic changes occur when the last brace is typed.

It seems that something is going wrong only when the next method in the class has an access modifier. I don't expect the next method to become indented at all, but understand that it might make sense based on the partially typed code. Nonetheless, it certainly shouldn't remain like that after I've finished typing. Is this a bug, a bad interaction with ViEmu, actually the intended behaviour or something messed up with my particular configuration? (Note: I tried with ViEmu disabled and got the same results. I also tried with the option to keep short accessors on a single line disabled, and found a similar unwanted indentation, although obviously the results weren't identical because the accessor ended up split across multiple lines, as expected.)

My R# version is Build 5.1.3000.12 on 2011-01-28T04:05:56, and Visual Studio is at version 10.0.30319.1.

4 comments

Hello Weeble,

Which version of ReSharper are you using? Could you please also attach a
screenshot of ReSharper | Options | Environment | Editor tab? Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

When I have a C# class like this:

class Foo
{
public void M1()
{
}
}
And then type the following text on the line above M1:

public int P1 { get { return 0; } }

Then as soon as I type the first closing brace, M1 is indented, and
does not become unindented after I type the second closing brace:

class Foo
{
public int P1 { get { return 0; } }
public void M1()
{
}
}
The behaviour is different if M1 doesn't have an access modifier. In
this case, typing the semicolon results in this (cursor location
indicated by underscore):

class Foo
{
public int P1 { get
{
return 0;_
void M1()
{
}
}
Then the first closing brace results in this:

class Foo
{
public int P1 { get { return 0; }_
void M1()
{
}
}
And no further automatic changes occur when the last brace is typed.

It seems that something is going wrong only when the next method in
the class has an access modifier. I don't expect the next method to
become indented at all, but understand that it might make sense based
on the partially typed code. Nonetheless, it certainly shouldn't
remain like that after I've finished typing. Is this a bug, a bad
interaction with ViEmu, actually the intended behaviour or something
messed up with my particular configuration? (Note: I tried with ViEmu
disabled and got the same results. I also tried with the option to
keep short accessors on a single line disabled, and found a similar
unwanted indentation, although obviously the results weren't identical
because the accessor ended up split across multiple lines, as
expected.)

My R# version is Build 5.1.3000.12 on 2011-01-28T04:05:56, and Visual
Studio is at version 10.0.30319.1.

---
Original message URL:
http://devnet.jetbrains.net/message/5317989#5317989



0

I've got Resharper Build 5.1.3000.12 on 2011-01-28T04:05:56

Here's the Options->Environment->Editor tab:
Resharper_Environment_Editor.png

0

Possibly of relevance - our C# files are generally stored with Unix line-endings, i.e. LF only, not CRLF, although it seems hard to keep them like this - I am frequently warned of mixed line-endings and have to reset the files to LF only. (I think I use Productivity Power Tools' "Fix Mixed Tabs" for that.) It might be that this problem depends on the line-endings of the existing code. I'll need to check.

0

Hello Weeble,

I've checked this behavior and it should be fixed in ReSharper 6.0: it removes
the indentation as soon as one types the second closing brace. Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I've got Resharper Build 5.1.3000.12 on 2011-01-28T04:05:56

Here's the Options->Environment->Editor tab:
Image:Resharper_Environment_Editor.png
---
Original message URL:
http://devnet.jetbrains.net/message/5318094#5318094



0

Please sign in to leave a comment.