consulo / consulo-csharp

Languages: C#
Apache License 2.0
50 stars 6 forks source link

Code Style for codes between Preprocessor #474

Closed potterdai closed 7 years ago

potterdai commented 7 years ago

For codes between Preprocessor, reformat will change their code style.

For example:

#if TEST
    public int TestMethod()
    {
        return 1;
    }
#endif

will be formatted to

#if TEST
    public int TestMethod()
    {
    return 1;
    }
#endif

which is not desired.

Better way is to just leave the codes there untouched.

VISTALL commented 7 years ago

Hi. This "if block" disabled(for clarity)?

Thanks

potterdai commented 7 years ago

Yep, it's the part to be disabled and be considered not to compile.

Thank you for such quick response! = )

VISTALL commented 7 years ago

I don't known how provide full formatting for disabled code (due it's not parsed as C# code).

It should ignore this block.

Will check it, when free time find me =)

potterdai commented 7 years ago

I think it should be ignored as well. But now it will be reformatted to align in column.

VISTALL commented 7 years ago

Hi. Disabled blocks now fully ignored by formatter. You can test fix when it will uploaded to release channel (https://github.com/consulo/consulo/wiki/Update-channels some documention about channels)

potterdai commented 7 years ago

Wow, that was fast! Thank you very much for the good work! = )

VISTALL commented 7 years ago

Hello. If you found any other issues - please report it, or if you want some not implemented feature.

Use https://discuss.consulo.io for discussions, or github for issues

Thanks

potterdai commented 7 years ago

Hey, just found the issue. After reformatting, the code become like this:

Before: screenshot 2017-05-17 21 30 36

After: screenshot 2017-05-17 21 30 41

There is a weird intend being formatted.

VISTALL commented 7 years ago

Can you try to reproduce this bug in simple example ?

potterdai commented 7 years ago

Hi, not sure how to do it here

if you create a file with:

screenshot 2017-05-17 21 41 22

And "Code" -> "Reformat Code" It will become something like this:

screenshot 2017-05-17 21 41 31

VISTALL commented 7 years ago

new issue https://github.com/consulo/consulo-csharp/issues/479

Strange how i not catch it.

Thanks you