Blank lines when moving members down/up with Alt + Shift + Ctrl + KeyUp|KeyDown

public string String1
{
get
{
return string1;
}
}
private string string1;
private string string2;
private string string3;
private string string4;

If you move the property String1 down with Ctrl + Shift + Alt + Keydown to
below the private member string4 this ReSharper adds blank lines between the
members giving the following result:

private string string1;

private string string2;

private string string3;

private string string4;

public string String1
{
get
{
return string1;
}
}

Gabriel Lozano-Morán
MCSD .NET
Real Software
http://www.realdn.net
http://www.Realsoftware.be


4 comments
Comment actions Permalink

Hello Gabriel Lozano-Morán,

I think your code style settings are set to keep one blank line between
members. "Move type member" is a simple feature which doesn't try to preserve
your local formatting.

Oleg Stepanov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

public string String1
{
get
{
return string1;
}
}
private string string1;
private string string2;
private string string3;
private string string4;
If you move the property String1 down with Ctrl + Shift + Alt +
Keydown to below the private member string4 this ReSharper adds blank
lines between the members giving the following result:

private string string1;

private string string2;

private string string3;

private string string4;

public string String1
{
get
{
return string1;
}
}
Gabriel Lozano-Morán
MCSD .NET
Real Software
http://www.realdn.net
http://www.Realsoftware.be



0
Comment actions Permalink

Why doesn't the reformatting of the code apply this settings? I always
believed that when you did a reformat it would not only optimize the using
references but also reformat the code as specified in the settings. Indeed
in my settings there is a blank line between members but a reformat does not
insert the blank lines.

Gabriel

"Oleg Stepanov (JetBrains)" <Oleg.Stepanov@JetBrains.Com> wrote in message
news:55e7741641341b8c7bfd8c375815c@news.intellij.net...

Hello Gabriel Lozano-Morán,

>

I think your code style settings are set to keep one blank line between
members. "Move type member" is a simple feature which doesn't try to
preserve your local formatting.

>

Oleg Stepanov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>
>> public string String1
>> {
>> get
>> {
>> return string1;
>> }
>> }
>> private string string1;
>> private string string2;
>> private string string3;
>> private string string4;
>> If you move the property String1 down with Ctrl + Shift + Alt +
>> Keydown to below the private member string4 this ReSharper adds blank
>> lines between the members giving the following result:
>>
>> private string string1;
>>
>> private string string2;
>>
>> private string string3;
>>
>> private string string4;
>>
>> public string String1
>> {
>> get
>> {
>> return string1;
>> }
>> }
>> Gabriel Lozano-Morán
>> MCSD .NET
>> Real Software
>> http://www.realdn.net
>> http://www.Realsoftware.be
>



0
Comment actions Permalink

Hello Gabriel Lozano-Moran,

My 'blank lines around single-line field' setting is zero - but the amount
of space that is added is due to the space added around the 'property' which
is a multi-line field - but it isn't removed again afterwards.
What is also interesting is that doing a reformat afterwards doesn't squish
them back together :(
But, by taking the 'keep max blank lines in code' option down to 0 the reformat
squishes them back together - and also removes ALL of my extra padding lines
:(
Then the 'move method' works fine!

Can't think of a clever way of defining the rules to allow us having extra
lines AND keeping things 'squished' whenever one wants as well.

But thanks - I hadn't realised this feature had been added - I seem to remember
asking (or at least thinking I should ask) for it a while back!

Ronnie


Why doesn't the reformatting of the code apply this settings? I always
believed that when you did a reformat it would not only optimize the
using references but also reformat the code as specified in the
settings. Indeed in my settings there is a blank line between members
but a reformat does not insert the blank lines.

Gabriel

"Oleg Stepanov (JetBrains)" <Oleg.Stepanov@JetBrains.Com> wrote in
message news:55e7741641341b8c7bfd8c375815c@news.intellij.net...

>> Hello Gabriel Lozano-Morán,
>>
>> I think your code style settings are set to keep one blank line
>> between members. "Move type member" is a simple feature which doesn't
>> try to preserve your local formatting.
>>
>> Oleg Stepanov
>> Software Developer
>> JetBrains, Inc
>> http://www.jetbrains.com
>> "Develop with pleasure!"
>>> public string String1
>>> {
>>> get
>>> {
>>> return string1;
>>> }
>>> }
>>> private string string1;
>>> private string string2;
>>> private string string3;
>>> private string string4;
>>> If you move the property String1 down with Ctrl + Shift + Alt +
>>> Keydown to below the private member string4 this ReSharper adds
>>> blank
>>> lines between the members giving the following result:
>>> private string string1;
>>>
>>> private string string2;
>>>
>>> private string string3;
>>>
>>> private string string4;
>>>
>>> public string String1
>>> {
>>> get
>>> {
>>> return string1;
>>> }
>>> }
>>> Gabriel Lozano-Morán
>>> MCSD .NET
>>> Real Software
>>> http://www.realdn.net
>>> http://www.Realsoftware.be


0
Comment actions Permalink

Hello Ronnie,

Sorry, 'keep blank lines in declarations' is the one that needs to be reduced
- NOT 'keep blank lines in code' as I stated below!

Ronnie

Hello Gabriel Lozano-Moran,

My 'blank lines around single-line field' setting is zero - but the
amount
of space that is added is due to the space added around the 'property'
which
is a multi-line field - but it isn't removed again afterwards.
What is also interesting is that doing a reformat afterwards doesn't
squish
them back together :(
But, by taking the 'keep max blank lines in code' option down to 0 the
reformat
squishes them back together - and also removes ALL of my extra padding
lines
:(
Then the 'move method' works fine!
Can't think of a clever way of defining the rules to allow us having
extra lines AND keeping things 'squished' whenever one wants as well.

But thanks - I hadn't realised this feature had been added - I seem to
remember asking (or at least thinking I should ask) for it a while
back!

Ronnie

>> Why doesn't the reformatting of the code apply this settings? I
>> always believed that when you did a reformat it would not only
>> optimize the using references but also reformat the code as specified
>> in the settings. Indeed in my settings there is a blank line between
>> members but a reformat does not insert the blank lines.
>>
>> Gabriel
>>
>> "Oleg Stepanov (JetBrains)" <Oleg.Stepanov@JetBrains.Com> wrote in
>> message news:55e7741641341b8c7bfd8c375815c@news.intellij.net...
>>
>>> Hello Gabriel Lozano-Morán,
>>>
>>> I think your code style settings are set to keep one blank line
>>> between members. "Move type member" is a simple feature which
>>> doesn't try to preserve your local formatting.
>>>
>>> Oleg Stepanov
>>> Software Developer
>>> JetBrains, Inc
>>> http://www.jetbrains.com
>>> "Develop with pleasure!"
>>>> public string String1
>>>> {
>>>> get
>>>> {
>>>> return string1;
>>>> }
>>>> }
>>>> private string string1;
>>>> private string string2;
>>>> private string string3;
>>>> private string string4;
>>>> If you move the property String1 down with Ctrl + Shift + Alt +
>>>> Keydown to below the private member string4 this ReSharper adds
>>>> blank
>>>> lines between the members giving the following result:
>>>> private string string1;
>>>> private string string2;
>>>>
>>>> private string string3;
>>>>
>>>> private string string4;
>>>>
>>>> public string String1
>>>> {
>>>> get
>>>> {
>>>> return string1;
>>>> }
>>>> }
>>>> Gabriel Lozano-Morán
>>>> MCSD .NET
>>>> Real Software
>>>> http://www.realdn.net
>>>> http://www.Realsoftware.be


0

Please sign in to leave a comment.